-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
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
Views: In "Unformatted list" format, Row classes don't render field tokens #5116
Comments
@bugfolder I didn't test yet, but for clarification: it works in D7 if entity_token is installed? Also: would it work in B if entity_token is installed, or is this completely unrelated to that? |
I think this is unrelated to entity_token (which doesn't exist by that name on D7). The field tokens are presented as possible replacement patterns in Views even with no token-related modules installed (in D7 or B). However, on further investigation, I've found that most of the field tokens do NOT work in "Row classes" even in D7. In fact, the only one I've found that does is "List (integer)", which requires the D7 List module to be enabled. (This was, in fact, the use case that led me to discover it; I upgraded a D7 site and found that the row class was broken.) So the 'field_image-fid] token doesn't work on D7 or B. But if you create a "List (integer)" field on the D7 site, add the field to the view, then use its token in a row class, it will work on D7 but not B. Many (most?) fields won't work on either. |
Hm... I just got it working in Backdrop.
I'm not 100% sure if every step of the above is necessary. And I'm also not sure if this works as intended... |
I've quickly tested most Backdrop core field types. Apart from the types mentioned above, the following work without problem:
Actually, the last has a problem if it's linked which is the default field configuration in Views. Similarly, many other field types work generally, but the output with default field configuration isn't really helpful. Examples:
|
The initial report claims that "This works on D7, not on Backdrop.". @bugfolder can you please edit it, to have it reflect what is a fact after recent comments/investigation?
Yeah, it is sad, but we are heavily behind on Views 7.x crossports. Whatever solution we come up with here, I would like us to first try and bring Backdrop core Views in parity with Views 7.x, then see if things are as broken. Otherwise, I'd like us to at least make sure to compare any behavior we see in Backdrop to how Views 7.x works (and thank you all for already doing that). In General, I'm really keen to bringing Backdrop core up to date with D7 crossports, and then moving on to Views 7.x crossports (and other 7.x contrib that has been merged into Backdrop core, but core and Views should be top priority). |
... https://www.drupal.org/project/views/issues/1414592 seems related (or another manifestation of the same issue). Can anyone please confirm? |
Updated. |
Confirmed this for image fields. |
Also confirmed it also doesnt work in D7. If you rearrange fields, youll find that only the actual field value is available to other fileds. So if you have the |
Description of the bug
In a View display as Unformatted list, one of the possible settings is "Row class", whose instructions say
The problem is that most of the tokens listed in "Replacement patterns" do not work for most fields.
Steps To Reproduce
To see the problem, on a basic Backdrop site (with Post content type predefined),
[field_image]
[field_image-fid]
[field_image-alt]
[field_image-title]
[field_image-width]
[field_image-height]
You will see that most of these tokens are not replaced in the row classes with their appropriate values; instead they show in in the row classes nearly verbatim (without the square brackets).
The attached View config file demonstrates the example.
If you add fields to the content type, add the fields to the View, and attempt to use their tokens, they similarly do not render. There's nothing special about the image field; I'm just using that as an example because it's already present in the post content type.
Actual behavior
Some tokens work (e.g., [title]), but many field tokens do not. Instead of rendering their value, they are rendered as token text without the square brackets.
Expected behavior
All field tokens should be rendered as their values in the "Row class" field.
This works on D7Some tokens work on D7 but not on Backdrop; others don't work on both D7 and Backdrop, even though they are listed in "Replacement patterns" for the fields.Additional information
Add any other information that could help, such as:
views.view.row_classes_test.json.txt
The text was updated successfully, but these errors were encountered: