PHP error on manage display of content entities with text basefields

Created on 27 October 2023, about 1 year ago
Updated 30 October 2023, about 1 year ago

Problem/Motivation

The following PHP fatal error occurs on the Manage display page for entities with 'text', 'text_long', or 'text_with_summary' base fields, rather than FieldConfig fields.

Error: Call to undefined method Drupal\Core\Field\BaseFieldDefinition::get() in Drupal\smart_read_more_link\Plugin\Field\FieldFormatter\SmartReadMoreLinkFormatter::isApplicable() (line 153 of /Users/jeff/sites/d9.test/web/modules/contrib/smart_read_more_link/src/Plugin/Field/FieldFormatter/SmartReadMoreLinkFormatter.php)

Steps to reproduce

  1. Install a clean copy of Drupal (I used D9) and the standard profile
  2. Visit the Manage display page for the Tags vocabulary (/admin/structure/taxonomy/manage/tags/overview/display)

Proposed resolution

Use FieldDefinitionInterface::getTargetEntityTypeId() instead of Drupal\field\Entity\FieldConfig->get('entity_type'), since Drupal\Core\Field\BaseFieldDefinition doesn't have a get() method.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jeffam

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

Comments & Activities

Production build 0.71.5 2024