Notice: Undefined index: render element in Drupal\Core\Theme\ThemeManager->render()

Created on 29 August 2019, almost 5 years ago
Updated 18 April 2023, about 1 year ago

get error: Notice: Undefined index: render element in Drupal\Core\Theme\ThemeManager->render() (line 200 of core/lib/Drupal/Core/Theme/ThemeManager.php).

This is because the theme hook does not return ['render element' => 'elements',]
Suggested code (minimal changes):

  $templates = array(
    'headbar_block' => array(
    //  'template' => 'headbar-block',
      'render element' => 'elements',
    ),
  );

There should be a change in block code to fit in with conventions:

      //$build['#theme'] = array('headbar_block');
      $build['#theme'] = 'headbar_block';
🐛 Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

🇬🇧United Kingdom Jons

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024