Error: Call to a member function load() on null in Drupal\media_taxonomy_filter\Plugin\views\argument\IndexTidMediaDepth->title()

Created on 9 August 2024, about 2 months ago

Problem/Motivation

Error: Call to a member function load() on null in Drupal\media_taxonomy_filter\Plugin\views\argument\IndexTidMediaDepth->title() is thrown after updating the module to 3.0.0-beta1 on Drupal 10.3.1.

This seems to be caused by the following line of code.

$term = $this->termStorage->load($this->argument);

Debugging $this->termStorage results in a null object.

Steps to reproduce

  1. Create a view page display with the following contextual filter: Media: Media has taxonomy term ID (with depth)
  2. Loading the page results in a a 500 error

Proposed resolution

Change:

$term = $this->termStorage->load($this->argument);

to use Drupal::entityTypeManager():

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($this->argument);

Remaining tasks

  1. Create a MR with the proposed resolution
  2. Test the change

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States vetchneons

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