Warning: Undefined array key "provider" in block_theme_suggestions_block() when flippy block is placed

Created on 7 September 2022, over 2 years ago
Updated 21 August 2024, 4 months ago

Problem/Motivation

When flippy is used and the block is placed for an entity type, visiting any node of that type results in:

Warning: Undefined array key "provider" in block_theme_suggestions_block()
Warning: Undefined array key "provider" in language_preprocess_block()
Warning: Undefined array key "provider" in menu_ui_preprocess_block()
Warning: Undefined array key "provider" in node_preprocess_block()
[...]

So a typical "provider" key seems to be missing or altered when Flippy is enabled.

Another interesting fact are these keys:

#plugin_id => string (6) "broken"
#base_plugin_id => string (6) "broken"

Steps to reproduce

See above

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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.

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin

    @Anybody: long holding issue here :) Maybe it isn't reproducable for you no more now. But I would like to inform that this happens without Flippy being installed here so I assume that we are close to inverstigate another issue, which can randimly affect many projects, maybe caused on other places or caused by methods used in contrib whicih need to be changed. Any news on yours?

  • 🇪🇪Estonia hanneshh

    I had the same problem. The warnings came after every time I flushed all caches.

    I think the problem is the same in this module. More precisely:

    • in file: flippy\src\Plugin\Block\FlippyBlock.php
    • in function: public function build() {
    • in the building of the variable $build

    The $build variable currently doesn't have this: '#configuration' => ['label' => $block->label(), 'provider' => $provider, ...

    .. And a lot of Drupal core modules have code that want this $provider value (like core/modules/block/block.module):

    /**
     * Implements hook_theme_suggestions_HOOK().
     */
    function block_theme_suggestions_block(array $variables) {
      $suggestions = [];
    
      $suggestions[] = 'block__' . $variables['elements']['#configuration']['provider'];
  • Status changed to Postponed: needs info 8 months ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @hanneshh but looking at the code I don't think flippy is doing anything wrong there?
    Back to postponed until we have clear steps for reproduction and can say what's causing this... I'm also unsure if flippy is causing this or not.

  • 🇧🇪Belgium DudeWeb

    I have this problem on 2 projects now... Must be related to core somehow...

  • 🇩🇪Germany Anybody Porta Westfalica

    @DudeWeb: Do you have flippy installed on both?

  • 🇲🇺Mauritius UNarain Mauritius

    @DudeWeb @Anybody, i think the issue is with twig tweak when calling blocks.
    Instead of calling your blocks as drupal_block('block_name'), you should be using drupal_entity('block', 'block_name')

Production build 0.71.5 2024