Hi,
find this warning. dont know since when it there.
i updated from 2.9 to 3.0 and the error still there.
Any idea ? Maybe its related to a another module.
Warning : Undefined array key "drupalmedia/drupal-media-entity" inDrupal\gutenberg\Controller\BlocksController->loadByType() (/web/modules/contrib/gutenberg/src/Controller/BlocksController.php ligne 147)

Issue fork gutenberg-3454471

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bensti created an issue. See original summary.

jonsimonsen’s picture

I'm seeing the same message when adding new content that use GB. We had a custom module with some GB blocks, but the message still appeared when that module was disabled.

My project is set up with Gin as admin theme. I'm not sure if that should have anything to say, but I noticed that gin_gutenberg is currently not installed. I'll just test if that makes any difference

jonsimonsen’s picture

So from what I can see, the log message appears immediately when going to add new content that is set up with GB. I've still not seen anything that is obviously broken in the editor. The issue seems to have appeared after upgrading to D10. I don't see similar messages on the D9 version of the site.

szeidler’s picture

Could you check, that the "Media" Gutenberg block is enabled in the content type's Gutenberg configuration?

If that is not the case, then it seems that the 2.x => 3.x update was not running properly or there was an issue in your config-workflow, so that it might have gotten reverted.

jonsimonsen’s picture

There is no "Media" in the GB blocks. Note that I did not upgrade to 3.x yet (the original post implied that there are issue on both 2.x and 3.x). I can try the upgrade and see how it looks afterwards

Edit: We can't upgrade to 3.x unless we change the dependencies in on of our internal modules

colorfield’s picture

Started to see the same in the logs after bumping from 2.8.0 to 2.9.0.
CI was fine (drush updb/drush cex committed), seeing drupalmedia/drupal-media-entity in the config export so seems to be related to #3305966: Media block is allowed even if not indicated as allowed

martins.bruvelis made their first commit to this issue’s fork.

martins.bruvelis’s picture

Checked that the warning is displayed when enabling block "drupalmedia/drupal-media-entity". However, there are no settings for "drupalmedia/drupal-media-entity" in `$definitions`. Therefore if the block definition in `loadByType` is empty, created a patch to return an empty array for the "drupalmedia/drupal-media-entity" and other blocks with empty block definitions.

szeidler’s picture

Priority: Minor » Major

The MR is fixing the issue for me. In my case this issue makes the whole Gutenberg stuck loading if the Media block is enabled and you're working in an environment that prints out warnings.

martins.bruvelis’s picture

If block definition in `loadByType` is empty, return `null`. The empty array cannot be used as \Drupal\gutenberg\GutenbergLibraryManager -> getActiveThemeDefinitions return results if activeThemeDefinitions value is declared and is not NULL (via is set ($this->activeThemeDefinitions)).

jonsimonsen’s picture

So I'm not so used to working with issue forks. Is it possible to create one here for GB 2.9, or will that require an entirely new issue to be created?

I did not see a button for creating a new issue fork here at least

jonsimonsen’s picture

I added a patch for Gutenberg 2.9 based on the current merge request

Tested it on a project where Gutenberg wasn't loading and the Javascript tab in developer tools showed this message

<br/><b>Warning</b>: Undefined array key "drupalmedia/drupal-media-entity " in <b>/var/www/html/web/modules/contrib/gutenberg/src/Controller/BlocksController.php</b> on line <b>119</b><br />

I did not observe any issues afterwards. I do see that GB 3.0 is structured somewhat differently so one of the files in the MR is not present in GB 2.9.

marcofernandes’s picture

Merged to 3.0.x. I'll keep this issue open if someone wants to do a MR for 8.x-2.x.

szeidler’s picture

Version: 3.0.0 » 8.x-2.x-dev
Status: Active » Needs review

Opened a MR based on the patch from @jonsimonsen. Quite straightforward, since we only needed the second part of @martins.bruvelis MR, since the LayoutProcessor is not part of 8.x-2.x.

  • szeidler committed 229556af on 8.x-2.x
    git commit -m 'Issue #3454471 by martins.bruvelis, szeidler, jonsimonsen...
szeidler’s picture

Status: Needs review » Fixed

Seems to have been an unrelated temporary failure. Merge succeeded now.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.