I have a Block view and content coming from content_block with number of fields.

So I want to access those fields value in custom template Is this possible? thanks

3 Answers 3


In a block twig you can access a field value like this:

{{ content['#block_content'].field_myfield.value }}

This is the database value of the field.

Most times you want to render a field:

{{ content.field_myfield }}

This will display the field as it is configured in the view mode.


Yes, it is possible with node template file. In node template file you get all the field values. please check this url for Twig Template naming conventions

  • content_block is rendered in bit special way than Nodes. Aug 23, 2016 at 13:30

This works for me in block.html.twig on Drupal 8.3.4

{{ content.field_myfield[0] }}

The code above will directly display the value of field_myfield in the block.html.twig template

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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