Structure of view in D10 has changed when fetching view from hook

Created on 11 October 2023, about 1 year ago
Updated 13 October 2023, about 1 year ago

Problem/Motivation

We have some custom code we are running on Drupal 9.5.8 + viewsreference 2.0.0-beta4 which works fine

When we switch the code to Drupal 10.0.10 + viewsreference 2.0.0-beta6 we observe our custom module code failing as the structure of variables has changed and not able to find the correct value.

in our hook_preprocess_block() we try and obtain our 'category links' view by specifying

$category_links_view = $variables['content']['field_category_links'][0]['contents']['#view'];

this is null.

I have attached images of the structure of this BEFORE and AFTER from [0] in $category_links_view

Steps to reproduce

- Switching to D10 core and the D10 compatible viewsreference module
- Try and obtain view in hook_preprocess_block()

Proposed resolution

?

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: duplicate

Component

Code

Created by

🇳🇿New Zealand simon2d

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

Comments & Activities

Production build 0.71.5 2024