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

Remaining tasks

User interface changes

API changes

Data model changes

Comments

donaldp created an issue. See original summary.

donaldp’s picture

Issue summary: View changes
donaldp’s picture

ivnish’s picture

Ready to fix

  • ivnish committed dd8c23f on 2.0.x
    Issue #3321707 by donaldp, ivnish: Can't use Layout Builder with the...
ivnish’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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