Attempt to determine if entity before running $this->getEntity($values)

Created on 28 February 2024, about 1 year ago
Updated 10 July 2024, 8 months ago

Problem/Motivation

I've noticed an error like Warning: Undefined array key "entity_type" in Drupal\views\Plugin\views\field\FieldPluginBase->getEntity() (line 444 of /core/modules/views/src/Plugin/views/field/FieldPluginBase.php) when using this field with non-entity-based views.

Steps to reproduce

1. Use the Denormalizer module to create a flat table.
2. Use the Views Database Connector module to access that table for your view.
3. Add a Views Simple Math Field field and perform a calculation.
4. Error like above shows in logs.

Proposed resolution

Check the $values array for an entity before running $this->getEntity($values).

Remaining tasks

Implement a fix, test.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States andileco

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