Can Media Library Media Modify be used with Image Widget Crop?

Created on 17 March 2022, over 2 years ago
Updated 12 September 2024, 2 months ago

I have a Media type 'Image' containing:
- Image field 'field_image'
- Text field: 'field_test'

On the Media type 'Image' form display, I set the Image field formatter to 'ImageWiget Crop' and select some available crop types

Now I have a layoutbuilder block 'image_block' with a 'Media with contextual modifications' field: field_media_item and the form display for that field is set to 'Media library extra.'

On a page I add 2 'image_block'.
For both I select the same Media Library item (both the same image from media livrary)

I can change the alt text and field_test so it has different values on image_block 1 and image_block 2.
This is great.
But If I also change the cropping, then that chage is not saved.
So I cannot set an image crop per image_block. That does not seem to work but i'd like it to.
Is there any way I can do this ?

img3 and img6 is the cropping I setup but that is not saved.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium flyke

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France DrDam

    Just updating this patch...

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    This has code seemingly ready to be committed so it is not only a support request anymore!

    DrDam did you miss adding a new patch in your last comment five months ago? And how does this issue interplay with your new module https://www.drupal.org/project/media_contextual_crop β†’ replacing multi_crop that you mentioned in comment 8?

    Thanks!

  • Status changed to RTBC over 1 year ago
  • πŸ‡«πŸ‡·France DrDam

    Hi,

    DrDam did you miss adding a new patch in your last comment five months ago?

    There have been no changes since #7.
    #13 are only an issue-meta update

    How does this issue interplay with your new modules replacing multi_crop that you mentioned in comment 8 ?

    In the same way multi_crop, I just implement this hook_alter in the "media_contextual_crop_field_formatter" module to add crop settings in context.
    As soon as the patch are merge, i'll clean the composer.json of my module

  • πŸ‡ΊπŸ‡ΈUnited States devkinetic

    @mlcn https://git.drupalcode.org/project/media_contextual_crop_field_formatter...

    "drupal/media_library_media_modify": {
      "#3270150 Add alteration": "https://www.drupal.org/files/issues/2022-06-08/manage_crops_3270150-7.patch"
    }
    
  • Status changed to Needs work 2 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    An alternate approach here would be for the module that needs the patch to decorate the media_library_media_modify service and make the changes it needs to \Drupal\media_library_media_modify\EntityReferenceOverrideService::getOverriddenValues - what speaks against this is the fact that \Drupal\media_library_media_modify\EntityReferenceOverrideService does not have an interface. Therefore I think that adding an alter seems okay and I guess it possible that other modules might need it too.

    It would be wonderful if an MR was created and if we added a media_library_media_modify.api.php file was created that describes the hook and why it should be used.

  • Merge request !64fix - 3270150 β†’ (Open) created by DrDam
  • Pipeline finished with Failed
    2 months ago
    Total: 215s
    #281084
  • Pipeline finished with Success
    2 months ago
    Total: 218s
    #281105
  • πŸ‡«πŸ‡·France DrDam

    I have made the MR on 1.x branch

  • Status changed to Needs review 2 months ago
  • πŸ‡«πŸ‡·France DrDam
  • πŸ‡«πŸ‡·France DrDam

    drdam β†’ changed the visibility of the branch 3270150- to hidden.

  • Merge request !65Closes #3270150 β†’ (Open) created by DrDam
  • πŸ‡«πŸ‡·France DrDam

    drdam β†’ changed the visibility of the branch 3270150-can-media-library-2x to hidden.

  • Pipeline finished with Success
    about 1 month ago
    Total: 190s
    #303906
  • πŸ‡«πŸ‡·France DrDam

    I have create a second merge-request for 2.x branch

Production build 0.71.5 2024