Error - Not enabled: Use theme_blazy()

Created on 7 December 2023, 6 months ago
Updated 21 April 2024, about 2 months ago

Problem/Motivation

The status report has a confusing error.

Blazy 3.x replaces sub-modules theme_ITEM() contents with theme_blazy(). Keep "Use theme_blazy()" enabled at Blazy UI to pass blazy:3.x.

I don't understand what this means, or why it mentions 3.x.

Steps to reproduce

I have Blazy module 8.x-2.22 with 1.8.2 for the library.

Proposed resolution

Change the error message to explain the problem better, so developers know how to fix it.

💬 Support request
Status

Fixed

Version

2.22

Component

User interface

Created by

🇺🇸United States mortona2k Seattle

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

Comments & Activities

  • Issue created by @mortona2k
  • 🇮🇩Indonesia gausarts

    Understood, thank you.

    Normally errors are more demanding than warnings :) And they would error, indeed, if ignored when updating from blazy:2.x to blazy:3.x.

    More relevant for custom works, though.

    By giving errors early before 3.x, hopefully any custom overrides at 2.x will be updated to reflect the changes. Otherwise errors as being warned about.

    Better wordings in the link there, or here:
    https://git.drupalcode.org/project/blazy/-/blob/8.x-2.22/docs/README.md?...

    Patches are welcome for improvements.

    Thank you.

  • 🇺🇸United States scottsawyer Atlanta

    I think the problem is the original poster, like myself, is not sure what this means, nor what to do about it. Do I need to change some code or configuration? If so, what? Please advise.

  • 🇮🇩Indonesia gausarts

    Make sense :)

    For now, there is a link in that error message to Blazy UI so to enable the Use theme_blazy() option in question.

    And the error should be gone.

    We should correct that message to be more clear. Feel free to advise me, or patch.

    Thank you.

  • 🇺🇸United States mortona2k Seattle

    As I'm understanding, you are warning developers about a change coming in 3.x, where theme_blazy() will override theme_ITEM().

    ITEM refers to other modules, like slick and splide.

    I searched the code and found references to theme_blazy(), but it does not appear to be implemented anywhere. Same for theme_slick_slide() or theme_splide_slide()

    Is this referring to BlazyElementTrait::themeBlazy()?

    At 3.x, we'll no longer ask for permissions, please be sure to test it out to
    spot the problems earlier, or migrate your overrides earlier.

    The theme_blazy() has been used all along, the only difference is captions
    which are now included as inherent part of theme_blazy() including thumbnail
    captions seen at sliders.

    What does this part mean?

  • 🇺🇸United States mortona2k Seattle

    I don't understand what any of this means:

    Profits:

    Tons of dups are reduced which is part of Blazy's job descriptions above.
    Minimal maintenance for many of Blazy sub-modules.
    More cool kid features like hoverable effects, etc. will be easier to apply.
    When Blazy supports extra captions like File description for SVG, it will be
    available immediately to all once, rather than updating each modules to
    support it due their hard-coded natures.

    Non-profits:

    Overrides should be taken seriously from now on, or as always. Perhaps CSS
    overrides are the safest. Or at most a hook_theme_suggestions_alter().
    One blazy stupid mistake, including your override, kills em all. We'll work
    it out at Bugs reports if blazy's. It happens, and the world does not end yet.

  • 🇺🇸United States mortona2k Seattle

    This bit might be helpful to me atm, I am trying to modify the output of the caption fields. The preprocess or blazy_caption_alter hooks seem like a good starting point. Or using the theme_suggestion_alter also makes sense if I need to have different templates.

    Is that the way to do it going forward? That makes sense to me as a site developer, and the other stuff sounds like it's for modules that depend on blazy?

    Custom work migrations from theme_ITEM() into theme_blazy():

    THEME_preprocess_blazy()
    hook_blazy_caption_alter(array &$element, array $settings, array $context)
    For more hook_alter: grep -r ">alter(" ./blazy, or see blazy.api.php

    Use settings.blazies object to provoke HTML changes conditionally via the
    provided settings alters. Samples are in blazy.api.php, more in sub-modules.
    As last resorts, override blazy.html.twig.

  • 🇺🇸United States mortona2k Seattle

    By giving errors early before 3.x, hopefully any custom overrides at 2.x will be updated to reflect the changes. Otherwise errors as being warned about.

    Are you saying that the checkbox just disables the error? If so, I would rather just see that in the 3.x release notes than have to worry about it now. If it actually does something, it would be great to clarify what it means to developers so they can do what you're suggesting.

  • 🇺🇸United States mortona2k Seattle

    The preprocess or blazy_caption_alter hooks seem like a good starting point.

    Unfortunately, hook_blazy_caption_alter() does not appear to be implemented in 2.22.

  • 🇮🇩Indonesia gausarts

    I don't think I can answer your questions properly :)

    However...

    The moral of that error message is early bird information. More for themers, or coders, who already customized theme_slick_slide(), and co. than end users. So they can update to 3.x without errors.

    Ignorable for most users, even coders, who don't modify those themes. If you are just starting out with Blazy, you can safely ignore them.

    Just tick the checkbox, and it should be good.

    1. theme_blazy() ... does not appear to be implemented anywhere.
    They are convention function names, normally called at D7. At D8 onwards, you will find them mostly called in render array like '#theme' => 'blazy' along with its arbitrary hook_preprocess_blazy(), and implemented in blazy.html.twig. Not theme_blazy() ansich.

    2. ...What does this part mean?
    You can ignore them. They only make sense if you override theme_blazy() and co. aka custom works. Only relevant for themers. Site builders or end users, or even coders, can just enable the Use theme_blazy() option, and nothing will happen visibly, only underground/ invisible changes at code level. Some coders would normally prefer hook_alter() seen at blazy.api.php, or even service swaps, themers twig files and preprocesses. Some other prefer both, whatever works. Your mileage vary.

    3. Profits and non-profits
    Similar to #2. Just reasons for the latest changes. Changes always have good and bad side effects. You are just being informed about in a friendly manner. Yet only relevant for those who may have worked with theme_slick_slide() and co. before those changes.

    4. checkbox just disables the error? .. would
    rather just see that in the 3.x .. than ... worry about it now. 

    Similar #2. Yes and no. Yes, errors are gone. No, it must be informed in 2.x, else errors in 3.x, if any customized and not updated accordingly. That is the point of the early error message. Under the hood, it modifies the direction of how output is themed and managed.

    Rest assured, like a bulb switch, most people don't have to worry about how circuit conductors -- neutral, ground, and phase, in alternating current work, how it travels the cable before hitting the bulb. Just a switch, and voila!

    5. hook_blazy_caption_alter() not ... implemented in 2.22.
    You are correct. No, not implemented in this module. It is for those who may need it to implement it.

    It is like jQuery.trigger(), and you can just implement it yourself by calling jQuery.on().

    Here is the trigger:
    https://git.drupalcode.org/project/blazy/-/blob/8.x-2.22/src/BlazyManage...

    In Drupal, you can implement it by MYMODULE_blazy_caption_alter() an MYMODULE.module file. Just use the correct modified arguments in there.

    And don't forget to clear cache whenever adding a function name for it to be recognized.

    Not all hook_alters are documented, some are in blazy.api.php:

    https://git.drupalcode.org/project/blazy/-/blob/8.x-2.x/blazy.api.php?re...

  • 🇳🇱Netherlands myDrupal2014_846824658246

    Clicking on the link gives a 404 error on page:

    admin/config/media/blazy

    Pls advice.

  • Status changed to Fixed 2 months ago
  • 🇮🇩Indonesia gausarts

    3.x. is out.

    Feel free to patch if any betterment in another thread to keep things organized.

    Thank you.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024