Linked Questions

2 votes
1 answer

How to get the values from a formatted field in inc file

I have a description field with a CK editor enabled. And when I get the data from it as node->get('fieldname')->getString() it outputs the content as below. The contents that I have entered in ...
i am batman's user avatar
1 vote
3 answers

Body Summary field showing literal ampersand character code in view

I have a Drupal 8 site where we've created a view, and decided to use the summary field instead of the trimmed body field, so that we could have more control over it. However, I got a bug report ...
user1359's user avatar
  • 3,919
3 votes
1 answer

Hide/Show fields value in nodes

I have a content type = Article. There I have 2 field. What I want is, If field 1 is empty or does not contain any value, replace this field with field 2, (with same css and html structure) else keep ...
Sugandh Khanna's user avatar
2 votes
1 answer

Show comment author e-mail in comment.html.twig

Anonymous users can leave their e-mail when posting a comment but how can I display this e-mail as a plain text value in the comment.html.twig?
rroose's user avatar
  • 360
1 vote
1 answer

Why precisely the twig raw filter is unsecure?

Why precisely the twig raw filter is insecure in the drupal context? What would be an example of a potential threat ? And what need to be done on the ckeditor field format side to protect potential ...
Matoeil's user avatar
  • 3,443
1 vote
1 answer

how do I access raw URL from a File Field to render it in twig inside href? [duplicate]

I have a "Our Staff" Content Type, that includes a field for uploading an individual's CV as a PDF: field_cv_file I have created a View for this Content Type, then added it to page via Blocks The ...
Auxiliary Joel's user avatar
0 votes
1 answer

|slice filter does not work with special characters

I try to use the slice filter in order to limit a link to a specific amount of characters. The field that I render is a link field and my code is the following: {% set title_text = title|render|...
kplatis's user avatar
2 votes
1 answer

how to just print the value of author in node template

There are some variables like author_name in node.html.twig of Drupal 8. {{ author_name }} will print something like below: <div><span><span>Basic</span></span></div&...
Basic's user avatar
  • 145
1 vote
1 answer

How can I embed a view in a template when passing view name and parameters are passed as variables?

Inside my paragraph template I have variables which contain category id and view machine name. So when I print them like this: {{ content.field_category }} {{ content.field_view }} I get correct ...
MilanG's user avatar
  • 539
0 votes
1 answer

What's the best way to put in a link to a translated node in a D8 template? [closed]

There just has to be a better way to insert a link to an alternative translation than this: function THEME_preprocess_node(&$variables) { $node = &$variables['node']; // Current ...
Mike Gifford's user avatar
0 votes
1 answer

Get raw value of a block content

I have created several views. These views have a block display. If I use these blocks in my template, the views are rendered with all the wrappers / divs. In my block template, can I alter the output ...
user28220's user avatar
  • 109
0 votes
1 answer

Applying trim to paragraph value

I have the following Paragraph template which displays a heading with a trailing orange dot. The field itself is a normal text field in Drupal. For some reason, there is a trailing space after the ...
mauzilla's user avatar
  • 173
0 votes
0 answers

how to get values for my content type drupal 8

i have a problem to get values in my twig for my content type , i have just the '{{content}}' variable with a lot of arrays , how can i get for example my field 'field_image' ? <div{{ attributes....
love coding's user avatar
-3 votes
2 answers

Can't seem to find a way to have & in a term description show up as &

In a site on D9. I have a vocabulary that has titles as the term descriptions. One of the term descriptions is This & That No matter what I try, the & is converted to & in CKeditor4. This ...
JAyenGreen's user avatar
-4 votes
1 answer

How can you separately get the name and the value of a field?

I want to get the key and the value of my row for example I have this: {{ content.field_nom }} but the out put is: my field name my value My question is how do you get 'my field name' alone ...
love coding's user avatar

15 30 50 per page