Compatibility with Block_field

Created on 7 May 2024, 7 months ago
Updated 22 May 2024, 6 months ago

When the Block_field module is used, Blocks are not placed in a region. The block include file tries to find the region of the block referenced by the block_field module, but then breaks, as the block is not placed.

The website encountered an unexpected error. Try again later.Error: Call to a member function getRegion() on null in sector_theme_theme_suggestions_block_alter() (line 21 of themes/contrib/sector_theme/includes/block.inc).Drupal\Core\Theme\ThemeManager->alterForTheme(Object, 'theme_suggestions', Array, Array, 'block') (Line: 467) Drupal\Core\Theme\ThemeManager->alter(Array, Array, Array, 'block') (Line: 394) Drupal\Core\Theme\ThemeManager->buildThemeHookSuggestions('block', '', Array) (Line: 220) Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 480) Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240) Drupal\Core\Render\Renderer->render(Array) (Line: 475) Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 181) __TwigTemplate_0444eda4cbc589bd8c236080583928f6->doDisplay(Array, Array) (Line: 360) Twig\Template->yield(Array) (Line: 335) Twig\Template->render(Array) (Line: 38) Twig\TemplateWrapper->render(Array) (Line: 1407) Twig\Extension\CoreExtension::include(Object, Array, 'moh:field', Array) (Line: 40) __TwigTemplate_937bccdd5ed8077adac004cb13de5d06->doDisplay(Array, Array) (Line: 360) Twig\Template->yield(Array) (Line: 335) Twig\Template->render(Array) (Line: 38) Twig\TemplateWrapper->render(Array) (Line: 39) twig_render_template('themes/custom/moh/components/field/field.html.twig', Array) (Line: 348)

Suggested fix https://git.drupalcode.org/project/sector_theme/-/blob/1.1.x/includes/bl...

  if ($block && $block->getRegion()) {
    $region = $block->getRegion();
  }
🐛 Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

🇳🇿New Zealand stewest Wellington

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024