- Issue created by @NicolasH
- 🇫🇷France Grimreaper France 🇫🇷
Hi,
For Twig variables meant to be used in HTML tag attributes, use settings ( https://www.drupal.org/project/ui_patterns_settings → ) in your pattern instead of fields.
- 🇦🇺Australia NicolasH
Thanks, I will use that module anyway eventually, so just tested it for this.
I chose the attributes type with this definition:
settings: href: type: attributes label: href expose_as_field: true
I need to use the expose_as_field option, as otherwise I can't map it in the view, I don't have a token.
Unfortunately I end up with the same result.
Now I think it would be reasonable to strip html comments in something like an attribute setting, so it still might be the best option to follow up in that module. Just posting this here as well in case I've missed something about your suggestion.
- 🇫🇷France Grimreaper France 🇫🇷
Hi,
attribute type is to have a twig variable to print as attributes, not a specific attribute value. use another type like textfield or url, see https://git.drupalcode.org/project/ui_suite_bootstrap/-/blob/5.0.x/templ....
I don't have opinion about the expose_as_field, as I don't have the views usage yet.
Hope this help!
- 🇫🇷France duaelfr Montpellier, France
Hi @NicolasH
I suppose that you might need ✨ Allow tokens for url of the Link field Needs work to get the token you want but maybe I'm not understanding your issue properly. - Status changed to Postponed: needs info
over 1 year ago 11:02am 20 June 2023 - 🇪🇸Spain idiaz.roncero Madrid
Same here, I tried to try to pass a plain URL text to a pattern using views but it outputs the twig debug comments when enabled.
No amount of views processing (removing whitespace, rewrite results, etc) prevents this.
A solution is to put {{ url | striptags | trim | etc }} on the pattern but this feels like a workaround and ... it should be implemented on all pattern props just in case you use a view? - it does not feel right.
- 🇦🇺Australia NicolasH
FWIW, outcome was still as in #7. I ended up with the same twig filter workaround and agree with Idiaz that it doesn't feel like a good solution.
None of the suggestions solve the issue when needing to map a URL in a view with twig debug on AFAICT. But not sure what further info can be provided.