1

I can't insert a block into an article on Drupal 8.

I installed the module, created a custom block, created an article using the Full HTML input format, inserted [block:block=1] into the article body, and saved it.
Nothing happened. [block:block=1] appears in the text instead of the desired block. I tried to find something in admin/config/content/formats/manage/full_html to make Drupal recognize the inserted blocks, but I found nothing.

Am I doing something wrong?

2

The insert block module implements an "input filter" via the core Filter module. A text format is a collection of enabled input filters. So when enabling a module that provides an input filter, the next step would be to configure the text format to use the input filter.

The Full HTML text format does not have that input filter enabled by default.

In addition the module has a Drupal 8 development release, but the code underneath still seems to use PSR-0 for its class loading and has not been updated in 3 years. It may be broken for other reasons as well.

0

You need to use hook_preprocess_page, put the block into a variable and then you print that variable in your template file (like this: {{ variable_with_the_block }} ).

  • How can I use this inside a node body? – user56564 Oct 25 '17 at 19:30
0

There is a new patch (https://www.drupal.org/files/issues/2018-06-08/2648496-46.patch) for insert_block and now the module works very well. I've tested it on a new Drupal 8.5.5 install.

See this issue for more information : https://www.drupal.org/project/insert_block/issues/2648496#comment-12644966

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.