Score:1

Get raw node id value in views template without errors

be flag

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?

Score:1
cn flag

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 }}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.