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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screenshot 2019-10-01 at 13.06.30.png | 32.3 KB | lslinnet |
Comments
Comment #2
lslinnet commentedComment #3
lslinnet commentedConfirmed that trying to add the "Thumbnail" field back from a disabled state breaks the page with either image or responsive_image formatters.
Comment #5
osmanThanks for reporting Lars, I was able to reproduce it easily.
Turns out the field definition (FieldDefinitionInterface) can either return a
FieldConfigor aBaseFieldDefinitionobject in hook_field_formatter_third_party_settings_form: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.
Comment #6
osmanComment #7
osman