0

I trying to add a region block to custom template Contact Form page: "contact-message-feedback-form.html.twig"

Define a region (like: contact_info) to theme-name.info.yml and add {{ page.contact_info }} in contact-message-feedback-form.html.twig

Contact form rendered successful but when add block to the region not display block in this region.

theme-name.theme:

/**
 * Implements hook_theme().
 */
function crown_ui_theme($existing, $type, $theme, $path) {
  return [
    'contact_message_feedback_form' => [
      'render element' => 'form',
    ]
  ];
}

theme-name.info.yml:

regions:
  contact_info: 'Contact Info'

contact-message-feedback-form.html.twig:

<div class="col-sm-3">
{{ page.contact_info }}
</div>
1

I used twig_tweak module to load and render a block on any where in Drupal. Read more on the module docs:

https://www.drupal.org/docs/8/modules/twig-tweak/rendering-blocks-with-twig-tweak

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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