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

  1. Go to manage display for an entity type with an extrafield.
  2. Select the checkbox to render the entity as a component.
  3. 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.

Command icon 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

jidrone created an issue. See original summary.

jidrone’s picture

Status: Active » Needs review

Create MR and moved to needs review.

e0ipso made their first commit to this issue’s fork.

e0ipso’s picture

Status: Needs review » Needs work
idiaz.roncero’s picture

I stumbled into this as well.

It looks like, for example, the links field that seems to be an addition of core itself is not a regular field but an extra field / computed field.

Only local images are allowed.

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.

e0ipso’s picture

Status: Needs work » Needs review

  • e0ipso committed e7b3b6f2 on 1.x authored by jidrone
    Issue #3382358 by e0ipso, jidrone, idiaz.roncero: Add extrafields...
e0ipso’s picture

Status: Needs review » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support to this project makes my volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work I did in this project, those include:
  • Triaging issues, and adding more context to existing issues.
  • Writing documentation, or patches for this project.
  • Writing blog posts, speaking about it at conferences.

Status: Fixed » Closed (fixed)

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