Ensure entity views argument definitions include the entity_type property.

Created on 18 October 2024, 6 months ago

Problem/Motivation

Follow up issue from πŸ› Label token replacement for views entity reference arguments not working Needs work where existing sites making use of argument plugins like node_id were crashing the site.

Steps to reproduce

1. Install the tracker module
2. Create a view which uses the tracker's ID as a contextual filter.
3. Save the view.
4. Viewing the view on the frontend results in a crash.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 142 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).
Drupal\Core\Entity\EntityTypeManager->getHandler(NULL, 'storage') (Line: 195)
Drupal\Core\Entity\EntityTypeManager->getStorage(NULL) (Line: 75)
Drupal\views\Plugin\views\argument\EntityArgument->titleQuery() (Line: 80)
Drupal\views\Plugin\views\argument\NumericArgument->title() (Line: 1048)
Drupal\views\Plugin\views\argument\ArgumentPluginBase->getTitle() (Line: 1169)
Drupal\views\ViewExecutable->_buildArguments() (Line: 1326)
Drupal\views\ViewExecutable->build(NULL) (Line: 1450)
Drupal\views\ViewExecutable->execute(NULL) (Line: 1513)
Drupal\views\ViewExecutable->render() (Line: 133)
Drupal\views\Plugin\views\display\Block->execute() (Line: 1689)
Drupal\views\ViewExecutable->executeDisplay('block_1', Array) (Line: 81)
Drupal\views\Element\View::preRenderViewElement(Array) (Line: 61)
Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)

Proposed resolution

Ensure all hook_views_data() declarations of the file_fid, node_nid, taxonomy, vocabulary_vid, user_uid views argument plugins have a corresponding entity_type property set.

Remaining tasks

Provide an update path for the existing views, as well as ensure all the

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

TDB

πŸ› Bug report
Status

Active

Version

10.3 ✨

Component

views.module

Created by

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