Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {{ node.title.value }}
- {{ content.field_text }}
- {{ drupal_view('mysection', 'block_1') }}
- {{ drupal_block('mytheme_breadcrumbs') }}
- {% include '@mytheme/includes/section.html.twig' %}
- node--page.html.twig
- region--myregion.html.twig
- block--entityviewcontent.html.twig
- cache: false
- debug: true
- <!-- THEME DEBUG -->
- <!-- THEME HOOK: 'block' -->
- <!-- FILE NAME SUGGESTIONS:
- * block--block-name.html.twig
- * block--block-content--b436f9c6-34ae-4879-8b55-068015a999d3.html.twig
- * block--block-content--bundle-name.html.twig
- * block--block-content.html.twig
- * block--block-content.html.twig
- x block.html.twig
- -->
- <!-- BEGIN OUTPUT from 'themes/bootstrap/templates/block/block--system.html.twig' -->
- {% if nid %}
- nid:{{nid}} <br/>
- title:{{node_title}} <br/>
- body:{{body}}<br/>
- text:{{field_text}} <br/>
- {% endif %}
- function THEMENAME_preprocess_block(&$vars){
- $node = Drupal::routeMatch()->getParameter('node');
- if ($node instanceof DrupalnodeNodeInterface) {
- // You can get nid and anything else you need from the node object.
- $vars["nid"] = $node->id();
- $vars["node_title"] = $node->getTitle();
- $vars["body"] = $node->body->value;
- $vars["field_text"] = $node->field_text->value;
- //following did not work ?!
- //$vars["field_text"] = $node->get('field_text')->getValue();
- //$vars["field_text"] = $node->field_text->getValue();
- }
- }
Add Comment
Please, Sign In to add comment