Problem/Motivation

This change is coming from the feedback that we've received from the patch submission that we've made on 9/23/2020.

  1. +++ b/core/themes/olivero/css/components/field-image.pcss.css
    @@ -0,0 +1,51 @@
    +.page-node-type-article {
    +  .field--name-field-image {
    

    Could we make this a reusable component so that it's not tied to the article node type and field with name image?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

proeung created an issue. See original summary.

kostyashupenko’s picture

Status: Active » Needs review
StatusFileSize
new11.95 KB
kostyashupenko’s picture

Project: Olivero » Drupal core
Version: 8.x-1.x-dev » 9.2.x-dev
Component: Code » Olivero theme
mherchel’s picture

Status: Needs review » Reviewed & tested by the community

This looks good. Tested this and it works exactly like expected.

At some point I want to add utility classes like md:pull-1 and lg:w-12 etc. But we can look into refactoring this at that point.

+1 RTBC!

mherchel’s picture

Title: [Code Review] Make .page-node-type-article a reusable component/class » [Code Review] wide image within article template a reusable component/class
lauriii’s picture

Could someone reupload the patch so that we can get the CI to run?

mherchel’s picture

StatusFileSize
new11.95 KB

@kostyashupenko's patch from #2 is attached.

mherchel’s picture

Version: 9.2.x-dev » 9.1.x-dev
StatusFileSize
new11.87 KB

The previous patch does not apply. Re-rolled patch from #2 attached.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/olivero/olivero.theme
@@ -338,6 +338,10 @@ function olivero_preprocess_field(&$variables) {
+  if ($variables['field_name'] == 'field_image' && $variables['entity_type'] == 'node' && $variables['element']['#bundle'] == 'article' && $variables['element']['#view_mode'] == 'full') {

I'm wondering if we could improve this part. What if I wanted to use this on something else than article, or field with another name than field_image?

fmb’s picture

Version: 9.1.x-dev » 9.2.x-dev
StatusFileSize
new11.88 KB

Re-rolled patch.

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new11.79 KB
new595 bytes

We can add wide-image class to the image field type.

anmolgoyal74’s picture

StatusFileSize
new11.69 KB
new2.81 KB
andy-blum’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new563.17 KB

#12 looks good. Patch applies cleanly, passed CI, and does what it needs to.

- Moves & updates css from 'css/components/field-image' to 'css/components/wide-image'
- Updates libraries.yml with new CSS file
- Adds 'wide-image' class to fields when field is of type 'image' and #view_mode is 'full'

Screenshot attached, moving to RTBC.

andy-blum’s picture

mherchel’s picture

mherchel’s picture

+1 on RTBC

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: 3173008-12.patch, failed testing. View results

catch’s picture

Status: Needs work » Reviewed & tested by the community

Restoring status after HEAD was broken.

lauriii’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/themes/olivero/olivero.theme
@@ -345,6 +345,10 @@ function olivero_preprocess_field(&$variables) {
+  if ($variables['field_type'] == 'image' && $variables['element']['#view_mode'] == 'full') {

Should we also check if the field cardinality has been configured to allow multiple images since this probably only makes sense for fields with single image?

mherchel’s picture

Status: Needs review » Needs work
paulocs’s picture

I'm working on it.

paulocs’s picture

Status: Needs work » Needs review
StatusFileSize
new543 bytes
new11.73 KB
mherchel’s picture

Status: Needs review » Reviewed & tested by the community

This looks great to me. RTBC! Thank you for the work.

One note:

+++ b/core/themes/olivero/olivero.theme
@@ -348,6 +348,10 @@ function olivero_preprocess_field(&$variables) {
+  if ($variables['field_type'] == 'image' && $variables['element']['#view_mode'] == 'full' && !$variables["element"]["#is_multiple"]) {

This prevents the output of the wide-image CSS class if the field is set to allow multiple images, but only one image is uploaded. But honestly, I'm okay with this.

mherchel’s picture

  • lauriii committed f65ce59 on 9.3.x
    Issue #3173008 by anmolgoyal74, mherchel, paulocs, kostyashupenko, FMB,...

  • lauriii committed fd638d0 on 9.2.x
    Issue #3173008 by anmolgoyal74, mherchel, paulocs, kostyashupenko, FMB,...
lauriii’s picture

Version: 9.3.x-dev » 9.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed f65ce59 and pushed to 9.3.x and cherry-picked to 9.2.x because Olivero is experimental. Thanks!

Status: Fixed » Closed (fixed)

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