Problem/Motivation
Some image style effects plugins (ie. Focal point) need the image dimensions to work.
As \Drupal\styleguide\Plugin\Styleguide\ImageStyleguide does not provide them, the styleguide page throws a fatal error when one of the image styles needs them.
Steps to reproduce
- Enable Styleguide
- Enable Focal point
- Configure one image style that use focal point
- Try to load the styleguide page
Proposed resolution
Provide widht and height values.
Issue fork styleguide-3258025
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
duaelfrComment #5
dave reidI'm not able to replicate the issue, I have a site using Focal Point and I'm not seeing any fatal errors on the current 2.x branch.
Comment #6
duaelfr(I'll try to find time to reproduce that tomorrow. In the meantime I rerolled the MR)
Comment #7
duaelfr@Dave Reid Thank you for trying to reproduce. I found out that this has been fixed in the Focal point module by "chance" (D10 compatibility issue)
https://git.drupalcode.org/project/focal_point/-/commit/d6f8823#035115c4...
I don't know if other image style extension modules have the same kind of issue or not but it seem safer to me to assume it could.
After digging a bit I now see two options:
template_preprocess_image_style_preview()'#theme' => 'image_style_preview'in your module instead of creating a custom preview so you don't have to worry about it anymoreWhat do you think?
Comment #8
dave reidI'm torn about this because I think not providing the height and width is generally the default behavior for theme_image_style. There are several usages in core itself that do not do this:
\Drupal\media\MediaListBuilder::buildRow()\Drupal\media_library\Form\AddFormBase::buildEntityFormElement()I also find many uses of this in contrib as well. I am tempted to say this was a bug in Focal Point that was resolved and not here, as this seems to be a fairly common use without providing them.
Comment #9
duaelfrNo need to keep that open :)
Thanks Dave!