Problem/Motivation
Unable to enable the "Use Layout Builder" option on the Media Gallery Structure->Media Gallery "Manage Display" tab.
This causes the following error:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "hidden" plugin does not exist. Valid plugin IDs for Drupal\Core\Field\FormatterPluginManager are: address_country_default, address_zone_default, address_plain, address_default, colorbox, comment_permalink, comment_username, comment_default, datetime_default, datetime_time_ago, datetime_plain, datetime_custom, file_uri, file_extension, file_url_plain, file_table, file_default, file_size, file_rss_enclosure, file_video, file_filemime, file_audio, file_link, image, image_url, link, link_separate, oembed, media_thumbnail, metatag_empty_formatter, list_default, list_key, entity_reference_rss_category, text_trimmed, text_default, text_summary_or_trimmed, author, user_name, number_integer, number_decimal, entity_reference_entity_view, number_unformatted, entity_reference_entity_id, boolean, basic_string, language, string, timestamp, entity_reference_label, email_mailto, uri_link, timestamp_ago in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /var/www/drupal.9/html/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Steps to reproduce
With Drupal 9.4.8 for example:
Install the Media Gallery module. Go to the "structure->Media Gallery" page.
Open the "Manage Display" tab.
Select the "Use layout builder" option at the bottom in "Layout Options".
Click the Save button.
Proposed resolution
It is believed that this issue is cause by the Media Gallery module src/Entity/MediaGallery.php file using deprecated code.
Instances of code such as:
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'hidden',
'weight' => 10,
])
should probably be changed to:
->setDisplayOptions('view', [
'label' => 'hidden',
'region' => 'hidden',
'weight' => 10,
])
I'm not sure if all such instances should be changed (there are 3 in the file) as I'm not familiar enough with the code.
However when I change all 3 the issue is resolved.
$fields['uid'] = BaseFieldDefinition::create('entity_reference')
$fields['created'] = BaseFieldDefinition::create('created')
$fields['status'] = BaseFieldDefinition::create('boolean')
The source of this solution is from here: https://www.drupal.org/project/workbench_reviewer/issues/3206970
Comments
Comment #2
donaldp commentedComment #3
donaldp commentedComment #4
ivnishReady to fix
Comment #6
ivnish