Hidden path field in views can't be accessed in twig

Created on 16 February 2018, over 6 years ago
Updated 14 December 2023, 11 months ago

I have a path field in a view which I have hidden and I want to access the link in my custom views-view-fields--[views-name]--[display-type].html.twig

For this I use:
<a href="{{ fields.path.content|render|striptags|trim }}">

The problem is that the link is only inserted if the path field is not hidden. Otherwise the output of the variable is empty.

πŸ› Bug report
Status

Closed: works as designed

Version

9.5

Component
ViewsΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡©πŸ‡ͺGermany johnnny83

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Going through old issues for the Bug Smash Initiative.

    I'd say this is by design, the field is hidden, which in Views lingo means it shouldn't be rendered, so it's not passed on to the rendering layer.

    If you feel that this is something that is needed we could reopen this as a feature request, but not sure this would fit the 80% case.

  • πŸ‡©πŸ‡ͺGermany johnnny83

    Uh, this is six years ago and I absolutely don't remember why I needed this πŸ˜…, but I suppose I managed to solve it some other way. But thank you for asking!

    Anyway, a hidden field can be embedded in other fields or used for grouping etc. so it is still available for other actions, so I think then it should also be accessible in twig.

Production build 0.71.5 2024