Problem/Motivation
When the view mode that wants to be rendered as a component has a extrafield the following error appears:
Call to a member function getLabel() on null in Drupal\sdc_display\Form\ViewModeMappingsSettings->getDynamicMappingsSelectorOptions()
Steps to reproduce
- Go to manage display for an entity type with an extrafield.
- Select the checkbox to render the entity as a component.
- Save
Proposed resolution
The issue comes from a part of the code which is assuming that only entity fields will be rendered, so when it tries to extract the field configuration to get the label it fails.
Instead of just adding a condition to skip the extrafields, I prefer this module to support them, so they can appear in the field mapping.
Issue fork sdc_display-3382358
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jidrone commentedCreate MR and moved to needs review.
Comment #5
e0ipsoComment #6
idiaz.ronceroI stumbled into this as well.
It looks like, for example, the
linksfield that seems to be an addition of core itself is not a regular field but an extra field / computed field.Having this field active makes sdc_display unusable as it will fail after mapping a view mode to a component.
+1 to having this, or at least having the ability to "bypass" extra fields to avoid the fatal error.
Comment #7
e0ipsoComment #9
e0ipso