1

I need to get the raw node id value in a views template, but the debug comments are interfering. Based on this issue I am using the following:

{{ row.columns.nid |render|striptags|trim }}

Which actually works, but I am also getting errors in the dblog relating the render method:

User error: "0" is an invalid render array key 
User error: "wrapper_element" is an invalid render array key
User error: "attributes" is an invalid render array key
User error: "default_classes" is an invalid render array key

Is there a better way to access the raw nid in a views template?

1

I assume this is about a views table template, then this topic might help How to access raw data in twig template using views table format.

Otherwise you could simply use

{{ row._entity.id }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.