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)
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3454471-13-gutenberg-2_9-undefined_array_key.patch | 589 bytes | jonsimonsen |
Issue fork gutenberg-3454471
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
Comment #2
jonsimonsen commentedI'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
Comment #3
jonsimonsen commentedSo 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.
Comment #4
szeidler commentedCould 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.
Comment #5
jonsimonsen commentedThere 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
Comment #6
colorfieldStarted 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
Comment #9
martins.bruvelisChecked 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.
Comment #10
szeidler commentedThe 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.
Comment #11
martins.bruvelisIf 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)).
Comment #12
jonsimonsen commentedSo 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
Comment #13
jonsimonsen commentedI 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.
Comment #14
marcofernandes commentedMerged to 3.0.x. I'll keep this issue open if someone wants to do a MR for 8.x-2.x.
Comment #16
szeidler commentedOpened 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.
Comment #18
szeidler commentedSeems to have been an unrelated temporary failure. Merge succeeded now.