drupal-twig-extensions
Version:
JavaScript implementation of Drupal’s Twig extensions
50 lines (48 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.options = exports.name = exports.acceptedArguments = void 0;
/**
* @file The safe_join filter
*
* Docs for TwigExtension::safeJoin (Drupal 9.3.x):
*
* ```
* new TwigFilter('safe_join',
* [$this, 'safeJoin'],
* [
* 'needs_environment' => TRUE,
* 'is_safe' => ['html']
* ]
* )
* ```
*
* ```
* Joins several strings together safely.
*
* @param \Twig\Environment $env
* A Twig Environment instance.
* @param mixed[]|\Traversable|null $value
* The pieces to join.
* @param string $glue
* The delimiter with which to join the string. Defaults to an empty string.
* This value is expected to be safe for output and user provided data
* should never be used as a glue.
*
* @return string
* The strings joined together.
* ```
*/
const name = 'safe_join';
exports.name = name;
const options = {
needs_environment: true,
is_safe: ['html']
};
exports.options = options;
const acceptedArguments = [{
name: 'glue',
defaultValue: ''
}];
exports.acceptedArguments = acceptedArguments;