It looks like the conditions in lazy_field_formatter_third_party_settings_form() needs a bit of tweaking, when trying to manage the view modes for a media entity created for the Media entity gist module I hit the following error:

Error: Call to undefined method Drupal\Core\Field\BaseFieldDefinition::id() in lazy_field_formatter_third_party_settings_form() (line 84 of modules/contrib/lazy/lazy.module).

Setup:
1. Using core Media modules, got Youtube, Youtube playlist, Vidyard, Vimeo, Image media entities
2. Setting up Media entity gist, for adding Code snippets as media entities. (composer require php-http/httplug:^1.1 php-http/guzzle6-adapter:^1.0 drupal/media_entity_gist)
3. Create new media entity type for Code snippet
4. Visit the Manage display page.

Debugging:
Playing a little with the formatters list in lazy_field_formatters it looks like the assumption that image will always be a special type of FieldDefinitionInterface fails in this case – I have not looked into if it is caused by Media Entity gist or this module, except for debugging a little to find the above observation.

This only happened on the initial configuration of it, once I removed "Thumbnail" from the fields list this error went away.

Comments

lslinnet created an issue. See original summary.

lslinnet’s picture

Issue summary: View changes
lslinnet’s picture

StatusFileSize
new32.3 KB

Confirmed that trying to add the "Thumbnail" field back from a disabled state breaks the page with either image or responsive_image formatters.

  • osman committed 3c32107 on 8.x-3.x
    Issue #3084882 by lslinnet:...
osman’s picture

StatusFileSize
new4.58 MB

Thanks for reporting Lars, I was able to reproduce it easily.

Turns out the field definition (FieldDefinitionInterface) can either return a FieldConfig or a BaseFieldDefinition object in hook_field_formatter_third_party_settings_form:

However, entity base fields, such as $node->title, are not managed by field.module and its "field_storage_config"/"field_config" configuration entities. Therefore, their definitions are provided by different objects based on the class \Drupal\Core\Field\BaseFieldDefinition, which implements this interface as well.

So, I wasn't really supporting any entity base fields in Lazy, including the Media's built-in Thumbnail field.

With the referenced commit, I tested multiple Media types, and can confirm it resolves the issue.

Each of the following Media types were set to use the built-in Thumbnail field and the main media field for its type in the default view mode:

Video, Image, File, Remote video, and Github gist

p.s. Media Entity Gist doesn't actually provide a default thumbnail image (github.png), I provided one for the test.

osman’s picture

Status: Active » Needs review
osman’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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