Linked Questions

5 votes
3 answers

How do I output HTML from a text_long field in Twig?

What is the alternative to the |raw filter if I want to output html from a entity field in twig in Drupal 8? According to this ticket, |raw should be avoided, but I can't figure out how to use what ...
Jens Wegar's user avatar
1 vote
1 answer

twig encoding html

I have a view that has two blocks. The blocks are essentially the same except for their filtering options. One uses contextual filters and the other uses BEF exposed filters. Both output matching ...
ice70's user avatar
  • 131
5 votes
1 answer

How to deal with Bubbleable Metadata when there's no rendering context and no render array

Since Drupal 8.0.0-beta12 "all rendering must happen in a render context", as stated by this change record. This is to avoid bubbleable metadata lost. So far, so good. Let's say I'm implementing a ...
sanzante's user avatar
  • 6,981
1 vote
2 answers

How can I get a rendered node field value with filters applied?

I'm trying to use a REST resource that accepts a node title and returns a JSON interpretation of a single field. This requires raw HTML that I can then use in DOMDocument. To get the rendered value of ...
blu's user avatar
  • 448
0 votes
1 answer

How to render content with <p> in twig to create paragraph

Sorry I'm newbie in drupal 8 I want to render my content from database which have <p> tags inside and my expectation every <p>content</p> will create new paragraph My database ...
sidikidis's user avatar
0 votes
1 answer

Getting the "processed" value of a formatted text field

I have a formatted text field on a content type that I'm using as the body of an email. If I load the node and print out the field I get: >>> $n->field_thankyou_email_body->getValue() =&...
Lambic's user avatar
  • 718
4 votes
2 answers

Rendered Webform has no Javascript attached

I've created a simple filter that allows webforms to be rendered anywhere in a node with a tag like this: [webform:machine_name] The code to render the form is as follows: $webform = \Drupal::...
Geat's user avatar
  • 463
2 votes
1 answer

Returning custom array in lazy builder callback

I have to return a custom array from a lazy builder callback and then loop through that array in a Twig template for a custom block. Here is my code so far: Custom block: public function build() { ...
user avatar
0 votes
1 answer

Custom block build function to display wysiwyg body text

I am learning to build custom blocks through a module. I am trying to get the build() function to work. I have the code and it works. However, if I edit the configuration of the block as a user it ...
timwhelan's user avatar
  • 258
0 votes
1 answer

How to prevent Cross Site Scripting when input using "Full HTML" mode of CKEditor

I am using Drupal version 8.3.7 and ckeditor 4.11.3. I create a basic page contains some scripts as following: In the detail page, I can see that the script in onmouseover="alert('222222')" is ...
Tai Nguyen's user avatar
0 votes
2 answers

print description and field value directly in taxonomy-term--drzava.html.twig

First I disable view for taxonomy-term, so I can use taxonomy-term--drzava.html.twig, where drzava is name of vocabulary. How to print description and filed value for taxonomy-term directly, without ...
SakaSerbia's user avatar
1 vote
1 answer

How to render text including video embed field

I have a formatted text field, and am using the video_embed module to allow users to embed video into that field, using the video_embed_wysiwyg submodule. I am then trying to render the field in a ...
gillarf's user avatar
  • 108
0 votes
1 answer

How can I add classes to the rendered "body" field on a content type?

Preface: I don't often work with Drupal, so I may not be using the correct terminology or fully understand the stack. Please bear with me, I'll do my best to be as clear as possible. I want to filter ...
JacobTheDev's user avatar
0 votes
0 answers

How to Render / Print Values correctly from Custom Blocks using Paragraphs via Entity Reference?

I've been trying to render/print the data from my custom blocks using paragraphs via entity reference to my twig template. So far I've managed to test and successfully print the data to my twig using ...
clestcruz's user avatar
  • 249
0 votes
2 answers

HTML is being printed in the output

The output from the below code is printing HTML. How can I make the "p" tags disappear? <p>answer 1</p> {% block paragraph %} <div {{ attributes.addClass(classes) }}> ...
brainHax's user avatar
  • 663