Closed (fixed)
Project:
Olivero
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2020 at 02:49 UTC
Updated:
16 Apr 2020 at 00:59 UTC
Jump to comment: Most recent, Most recent file
The hero image for the article content type requires a large 1090px wide image style. We can define this image style within the theme (see https://www.drupal.org/docs/8/theming-drupal-8/including-default-image-s...).
We need to
1) Define this image style within the theme
2) Configure the field to use this image style
Styling will be handled in a separate issue.

| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3123348-10-image-style.patch | 1.5 KB | mherchel |
| #9 | 3123348-8-image-style.patch | 1.5 KB | mherchel |
| #6 | 3123348-6.patch | 1.51 KB | kostyashupenko |
| #3 | 3123348-3.patch | 539 bytes | kostyashupenko |
| Olivero_Theme_-_Public_–_Figma-2.png | 638.51 KB | mherchel |
Comments
Comment #2
kostyashupenkoComment #3
kostyashupenkoI'm just adding image style here with effect
Scale, based only onwidthproperty. But second point of description is not clear for me in terms of how to do that:2) Configure the field to use this image styleSo we have to apply somehow our image style to the
Imagefield ofCT Article Defaultdisplay. Some thoughts:We don't know if installation profile contains CT "Article".
That means:
- We can't just copy/paste
core.entity_view_display.node.article.default.ymlconfig from for exampleStandardinstall profile toolivero/config/installand just override Image style ofImagefield there.- We can't copy/paste all article's configs into
olivero/config/installsince user may not need anArticle CT. For exampleMinimalstandard profile doesn't have any CTs.We may somehow override CT Article Default display from theme?
But i didnt find any possible solutions to do that. The principle was like:
- I use some hook to apply my changes right after
Oliverogot installed.- I'm checking using
\Drupal::configFactory()if Article's configs exist and then i'm trying to apply our image style to theImagefield.From what i found is that hook, but it didnt work for me. I was testing it like:
So any ideas about all of it?
Comment #4
andypostI also think that it's bad idea to provide config for image style inside of theme, and more weird when theme expects presence of image style or article teaser.
Instead better to create template override for image field from standard profile so it will be used when theme become default in core
Comment #5
mherchel@andypost I was hoping to keep the scope within the theme... but I agree that you're right that we should modify the standard profile.
@kostyashupenko is it possible to invoke the new image style via preprocess, and call that variable from the template? We're still theming against 8.x for now. We can create an issue to modify the 9.1 standard profile when we submit the core patch. Thoughts?
Comment #6
kostyashupenkoI don't think my patch is usable and i don't think we should use it somewhere. Main problem as i described already in my previous comment here is the following:
- Olivero theme doesn't know anything about installation profiles. Such things should live in installation profiles, 100% sure.
And some issues:
olivero.themefile. I don't know if it is actually possible. I'm not backender, but still, absolutely all really strong backenders in drupal runs away when i'm trying to ask about good solution for this issue. And this is normal reaction, because such things should live in core's profiles, not in theme.Comment #7
kostyashupenkoComment #8
mherchelThis is awesome. There were a few minor things that I'm going to fix (see below).
I'm going to rename the image style to
olivero_hero, and have the visible name be Hero.The name of this doesn't match the yml file name.
This needs to match the machine code of the image style.
Comment #9
mherchelRe-rolled and updated patch attached.
Comment #10
mherchelOne more patch... this time with upscaling turned off.
Comment #11
mherchelComment #12
mherchelCreated followup issue #3124297: Create Drupal 9 core issue to add a "hero" image style and let article use this by default for the full view mode. to fix this in 9.x when we submit a core patch.
Comment #13
mherchelCommitted! Thanks @kostyashupenko