Deepdives

Helpers

Overview

Helpers are functions that can be used in any part of the application. They are globally available and can be used anywhere in the application. The project has a helpers.php file in the app directory. This file contains all the helper functions that are used in the application.

List of Helpers

Function NameDescription
googleRecaptchaScriptEmbeds Google reCAPTCHA script if captcha is enabled.
checkedReturns 'checked' if two values are equal.
selectedReturns 'selected' if two values are equal.
isOtherTitleSelectedReturns 'selected' if a key is not present in the search array.
removeNewlinesRemoves extra whitespaces and newlines from a string.
isAppChecks if a cookie named 'minimalTheme' exists.
isEUChecks if the core region is not UK.
__dTranslates a key and returns the default value if the translation key matches the translation result.
wordpressImageReturns the image URL if available, otherwise returns the original image.
str_wordsTruncates a string to a specified number of words.
excluding_vatFormats a price with or without the "ex-VAT" label based on the core region.
cleanStrips HTML tags from a given string.
app_versionRetrieves the application version from the composer.json file.
_tsrcSortedAccesses regional configuration under the toolstation namespace and returns it sorted alphabetically.
superscriptableConverts specified substrings to their corresponding superscript form based on configuration.

Copyright © 2026