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

Comments

Anybody created an issue. See original summary.

anybody’s picture

Issue summary: View changes
anybody’s picture

Status: Active » Needs work

Resaving the block after configuring the flippy settings on the entity type made the error disappear.

Needs steps to reproduce though.

anybody’s picture

Priority: Normal » Minor
Status: Needs work » Postponed (maintainer needs more info)

No idea how that happened. Please add details, if it should happen to you.

anybody’s picture

I guess we should test the following:

  1. Freshly install flippy (not installed before, no settings existing in the system)
  2. Do NOT configure any content type yet
  3. Place the Flippy Block on the Blocks overview page

And see if that triggers the error. If that doesn't trigger the error, play around a bit and if we can't reproduce it, let's close this.
Anyway, as of the hooks listed, the error will only happen when using the flippy block in certain combinations.

dqd’s picture

Status: Postponed (maintainer needs more info) » Needs work

@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 randomly affect many projects, maybe caused on other places or caused by methods used in contrib, which need to be changed. Any news on yours?

dqd’s picture

hanneshh’s picture

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'];
anybody’s picture

Status: Needs work » Postponed (maintainer needs more info)

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.

dudeweb’s picture

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

anybody’s picture

@DudeWeb: Do you have flippy installed on both?

unarain’s picture

@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')

dqd’s picture

@unarain if you refer to the module "Twig_Tweak" this is not installed here by testing this issue, so again, as I sad already above long time ago, it is rather that something in core has changed and contrib needs to follow. So it could be affect multiple contrib projects.

And since this occurs here also without Flippy installed I would suggest to convert this issue to a core block component issue with a changed summary and changed goal for this task which suggests that core thows an exception with a better error output so that contrib maintainers can precicely refer to when/where it is caused on their projects and can change this accordingly.