I have the dev release running on my site (Drupal 8.2.3) and when I choose the Field Formatter with Inline Options, it causes the following error
TypeError: Argument 1 passed to Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings::getFieldDefinition() must implement interface Drupal\Core\Field\FieldStorageDefinitionInterface, null given, called in /modules/contrib/field_formatter/src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php on line 123 in/modules/contrib/field_formatter/src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php on line 109
#0 /modules/contrib/field_formatter/src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php(123): Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings->getFieldDefinition(NULL)
#1 /modules/contrib/field_formatter/src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php(224): Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings->getAvailableFormatterOptions(NULL)
#2 /core/modules/field_ui/src/Form/EntityDisplayFormBase.php(408): Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings->settingsForm(Array, Object(Drupal\Core\Form\FormState))
#3 /core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php(36): Drupal\field_ui\Form\EntityDisplayFormBase->buildFieldRow(Object(Drupal\field\Entity\FieldConfig), Array, Object(Drupal\Core\Form\FormState))
#4 /core/modules/field_ui/src/Form/EntityDisplayFormBase.php(180): Drupal\field_ui\Form\EntityViewDisplayEditForm->buildFieldRow(Object(Drupal\field\Entity\FieldConfig), Array, Object(Drupal\Core\Form\FormState))
#5 /core/lib/Drupal/Core/Entity/EntityForm.php(115): Drupal\field_ui\Form\EntityDisplayFormBase->form(Array, Object(Drupal\Core\Form\FormState))
#6 [internal function]: Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
...
The field is an entity reference to an image media entity (module media_entity_image).
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | Capture du 2018-07-06 16:45:19.png | 44.34 KB | grimreaper |
| #7 | interdiff-2-7.txt | 720 bytes | seanb |
| #7 | 2831921-7.patch | 1.72 KB | seanb |
| #2 | field_formatter-error_with_field_formatter_with_inline_settings-2831921-2.patch | 1.6 KB | bkhandruk |
Comments
Comment #2
bkhandruk commentedAdded a check to avoid getting formatter options when there is no definition for specified field.
Comment #3
bkhandruk commentedComment #4
slashrsm commentedCould you provide some steps to reproduce the problem. It would be also nice if we'd add the test coverage to prevent us from re-introducing this regression in the future.
Comment #5
slashrsm commentedComment #6
marcoscanoComment #7
seanbSmall extra fix that made it work for me. When you have the entity referenced field set on 'Rendered entity' and switch to 'Field formatter with inline settings' this occurs.
Needed a small extra fix to make it work though. Patch is attached.
This inline formatter will probably end up in core for 8.4 btw #2831943: Use "rendered media" (not links) as default media field formatter; add modal to configure the used media view mode
Comment #8
grimreaperHello,
Patch from comment 2 solved the issue.
Steps to reproduce :
- on a fresh drupal install
- enable media module
- add an entity reference field to a media entity on a content type
- go to the manage display of the content
- select the formatter "Field formatter with inline settings" (so before the default formatter is "label")
- ajax error
Comment #9
tim-dielsThe patch of #2 works perfect
Comment #10
anybodyWe're been using patch #7 on several sites without any problems. I'll set this RTBC, is there a plan for the next release which may include this?
Comment #12
anybodyCommited, thank you all!
Comment #13
anybodyCreated a new stable 1.2 release. Patches for tests are still very welcome.
Comment #14
grimreaperHello,
On the 8.x-1.2 version, with responsive image there is a problem.
I want to avoid to have to create view modes on media entity for the different image styles.
When using the formatter "Field formatter with inline settings":
See attached screenshot.
Thanks for any help.
Comment #15
grimreaperSorry for the double post.
I found why my responsive image style was not appearing (wrong configuration). So I can select it and so select another formatter.
But I think the problem will be back for any field formatter with a mandatory field without option.