Error: Call to undefined method Drupal\blazy\Blazy::preprocessBlazy() in custom module

Created on 28 July 2023, over 1 year ago
Updated 18 September 2023, about 1 year ago

Problem/Motivation

We were using preprocessBlazy() inside a custom template_preprocess_HOOK() implementation. After updating from 2.5.0 to 2.16.0, we get an error "Call to undefined method Drupal\blazy\Blazy::preprocessBlazy() in..."

I see an old CHANGELOG record "Deprecated Blazy::buildAttributes for ::preprocessBlazy" but haven't found anything about deprecating or removing preprocessBlazy.

Is there any info about the removal or a recommended replacement?

If it is relevant, here is a description of what our preprocess hook is doing:

/**
 * Implements template_preprocess_HOOK() for os_media_gallery_blazy.
 *
 * Prepares variables for the os_media_gallery_blazy theme hook, which is used
 * in blazy.html.twig templates. Specifically, this function alters the 'image'
 * variable to replace the image with a slick lightbox popup link.
 *
 * @param array $variables
 *   An associative array of variables to pass to the theme hook.
 *   The following keys are available:
 *   - image: An associative array representing the image, including attributes
 *     like width, height, alt, title, and class.
 *   - element: An array representing the element that contains the image. It
 *     includes an item representing the image and a slick popup URL. It can also
 *     optionally include a caption and a showCaption setting.
 */
function template_preprocess_os_media_gallery_blazy(&$variables) {
...
...snip
...
}
💬 Support request
Status

Fixed

Version

2.16

Component

Documentation

Created by

🇺🇸United States scottatdrake

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

Comments & Activities

Production build 0.71.5 2024