Failing due to nonexistant getType()

Created on 14 July 2023, over 1 year ago
Updated 9 December 2023, about 1 year ago

Problem/Motivation

I stumled on views failed to work on my D9.5 where it said that getType didnt exists.
There are no guarantee that an object have properties or functions which makes this fail.

views_pdf.module

LINE-58 if (in_array('getType', $classMethods))
if ('pdf' === $view->display_handler->getType()) {
$form['controls']['live_preview']['#default_value'] = FALSE;
}

To achieve a solution i altered it to

LINE-58
$classMethods = get_class_methods($view);
if (($class_methods!=NULL) && (in_array('display_handler', $classMethods)))
{
$classMethods = get_class_methods($view->display_handler);
if ($classMethods!=NULL)
if (in_array('getType', $classMethods))
if ('pdf' === $view->display_handler->getType()) {
$form['controls']['live_preview']['#default_value'] = FALSE;
}
}

Patch will follow

πŸ› Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden arne_hortell

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