RouteEnhancer::enhance() needs more type checking on passed term

Created on 29 July 2021, over 3 years ago
Updated 23 January 2023, almost 2 years ago

Problem/Motivation

In \Drupal\tvi\Enhancer\RouteEnhancer::enhance(), the $defaults['taxonomy_term'] is assumed to be either empty, or an instance of TermInterface, but no type checking is done on the value prior to passing it to \Drupal\tvi\Service\TaxonomyViewsIntegratorManagerInterface::getTaxonomyTermViewAndDisplayId().

Steps to reproduce

This issue surfaced when working with https://www.drupal.org/project/taxonomy_term_revision β†’ , where the value was the term ID, rather than an instance of the term object.

Proposed resolution

Add further type checking on the default value. If passed a numeric, attempt to load the related term.

Remaining tasks

Create patch.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States socketwench

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024