Guest User

Untitled

a guest
Jan 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. {{ node.title.value }}
  2. {{ content.field_text }}
  3. {{ drupal_view('mysection', 'block_1') }}
  4. {{ drupal_block('mytheme_breadcrumbs') }}
  5.  
  6. {% include '@mytheme/includes/section.html.twig' %}
  7.  
  8. node--page.html.twig
  9.  
  10. region--myregion.html.twig
  11.  
  12. block--entityviewcontent.html.twig
  13.  
  14. cache: false
  15. debug: true
  16.  
  17. <!-- THEME DEBUG -->
  18. <!-- THEME HOOK: 'block' -->
  19. <!-- FILE NAME SUGGESTIONS:
  20. * block--block-name.html.twig
  21. * block--block-content--b436f9c6-34ae-4879-8b55-068015a999d3.html.twig
  22. * block--block-content--bundle-name.html.twig
  23. * block--block-content.html.twig
  24. * block--block-content.html.twig
  25. x block.html.twig
  26. -->
  27. <!-- BEGIN OUTPUT from 'themes/bootstrap/templates/block/block--system.html.twig' -->
  28.  
  29. {% if nid %}
  30. nid:{{nid}} <br/>
  31. title:{{node_title}} <br/>
  32. body:{{body}}<br/>
  33. text:{{field_text}} <br/>
  34. {% endif %}
  35.  
  36. function THEMENAME_preprocess_block(&$vars){
  37. $node = Drupal::routeMatch()->getParameter('node');
  38. if ($node instanceof DrupalnodeNodeInterface) {
  39. // You can get nid and anything else you need from the node object.
  40. $vars["nid"] = $node->id();
  41. $vars["node_title"] = $node->getTitle();
  42. $vars["body"] = $node->body->value;
  43. $vars["field_text"] = $node->field_text->value;
  44.  
  45. //following did not work ?!
  46. //$vars["field_text"] = $node->get('field_text')->getValue();
  47. //$vars["field_text"] = $node->field_text->getValue();
  48. }
  49. }
Add Comment
Please, Sign In to add comment