Browse Source

Issue #3174903 by Niklan, ygoex: Error: Call to a member function getRegion() on null in hook_theme_suggestions_block_alter()

merge-requests/2/head
Niklan 4 years ago committed by Chi
parent
commit
2fd6b6c5b9
  1. 2
      src/View/BlockViewBuilder.php
  2. 4
      tests/src/Kernel/BlockViewBuilderTest.php

2
src/View/BlockViewBuilder.php

@ -139,7 +139,7 @@ class BlockViewBuilder {
if ($wrapper && !Element::isEmpty($build['content'])) {
$build += [
'#theme' => 'block',
'#id' => $configuration['id'] ?? $id,
'#id' => $configuration['id'] ?? NULL,
'#attributes' => [],
'#contextual_links' => [],
'#configuration' => $block_plugin->getConfiguration(),

4
tests/src/Kernel/BlockViewBuilderTest.php

@ -46,7 +46,7 @@ final class BlockViewBuilderTest extends KernelTestBase {
],
],
'#theme' => 'block',
'#id' => 'twig_tweak_test_foo',
'#id' => NULL,
'#attributes' => [
'id' => 'foo',
],
@ -74,7 +74,7 @@ final class BlockViewBuilderTest extends KernelTestBase {
],
];
self::assertSame($expected_build, $build);
self::assertSame('<div id="block-twig-tweak-test-foo">Foo</div>', $this->renderPlain($build));
self::assertSame('<div id="foo">Foo</div>', $this->renderPlain($build));
// -- Non-default configuration.
$configuration = [

Loading…
Cancel
Save