How to use extra fields in component

Created on 25 February 2024, about 1 year ago

Problem/Motivation

I created a component to display the header for a content type, containing a title, back link, add to any links, and some details.

The back link and add to any are added via hook_entity_extra_field_info, and the value set in hook_entity_view().

When I try to render the view mode as a component and insert the back link or add to any field, it throws an error:

InvalidArgumentException: Field addtoany is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Drupal\Core\Entity\ContentEntityBase->get('addtoany') (Line: 159)
Drupal\sdc_display\Util::Drupal\sdc_display\{closure}(, 'addtoany')
array_reduce(Array, Object, ) (Line: 160)
Drupal\sdc_display\Util::computeSlotValues(Array, Array, Array, Array, Object) (Line: 301)
sdc_display_entity_view_alter(Array, Object, Object) (Line: 545)
πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024