We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to have the same functionality as classes/classnames like the npm library for React so I can easily send an array to the class prop.
new TwigFilter('classes', [$this, 'stringifyHtmlClasses']), /** * @param string[] $classes */ public function stringifyHtmlClasses(array $classes): string { return implode(' ', $classes); }
<Text size="large" class="{{ [ 'text-secondary', _person.description ? 'mb-1' : 'mb-0' ]|classes }}" > {{- _person.role -}} </Text>
The text was updated successfully, but these errors were encountered:
The join filter wouldn't work for you?
join
[ 'text-secondary', _person.description ? 'mb-1' : 'mb-0' ] | join(' ')
The join filter is basically an implementation of PHP's implode().
implode()
Sorry, something went wrong.
No branches or pull requests
I want to have the same functionality as classes/classnames like the npm library for React so I can easily send an array to the class prop.
The text was updated successfully, but these errors were encountered: