- Issue created by @jox
- π«π·France DrDam
MΓ©dia Contextual Crop API came with a patch on Crop module. This patch add an data-field in the crop entity.
Can you check if the patch correctly applied
composer reinstall drupal/crop
Did you have run an
drush updb
after install crop with composer ? - π©πͺGermany jox
Thanks for the quick reply!
Which patch do you mean exactly, do you have a link? I saw some patch requirement before. I was wondering about it and concluded that it was already merged. Did you just update the project description and take out that patch info?
I certainly did
drush updatedb
anddrush cache:rebuild
after install.I now did
composer reinstall drupal/crop
as you told with anotherdrush updatedb
, but the problem remains... - π«π·France DrDam
In the media_contextual_crop (2.x) have a patch in the composer.json :
"drupal/crop": { "provide_contextual_capability_to_crops": "https://www.drupal.org/files/issues/2023-11-06/%232617818-31-provide_contextual_capability_to_crops.patch" }
It theorie, composer patch will apply it automaticly
If you run a
composer reinstall drupal/crop
you may this response in the console- Installing drupal/crop (2.3.0): Extracting archive - Applying patches for drupal/crop https://www.drupal.org/files/issues/2023-11-06/%232617818-31-provide_contextual_capability_to_crops.patch (provide_contextual_capability_to_crops)
After the path applied, you may have to run a
drush updb
in order to apply thecrop_update_8006
"Add context field to Crop entity" - Assigned to DrDam
- π©πͺGermany jox
All right. The patch is not getting applied automatically in my setup. I did it manually and
crop_update_8006
is applied now afterupdb
!The error is gone, but unfortunately I still have no cropping abilities...
- π«π·France DrDam
Are you sure using a "media with contextual modification" instead of the native "reference" field ?
In term of configuration :
0. Define a CROP and an image style using this crop
1. In the CONTENT TYPE,
- On field configuration : be sure using a "media with contextual modifications" field type, instead of the "native entity reference" field type ?
- On view mode : choose the "render" formater and a view mode for the media2. In the MEDIA Image STRUCTURE, you need to set :
- in the form mode : use Image widget Crop
- in the media view mode (the one used by the content type) : use the formater "Context crop image" on the field_image, and select a image_style who use a crop - π©πͺGermany jox
Thanks for the help! I followed your steps and I am getting closer, but still got issues. I now have the crop widget in the node edit form and can select a crop area, but:
- It does not save my crop configuration. I.e. it forgets it. The next time I open the modal crop area is back to full image.
- In the image modal there is a warning "This crop definition affects more usages of this image".
- I cannot see any preview for my crop selection. - π«π·France DrDam
If you have difficulty applying the patches, this is probably due to the fact that the patch on media_library_media_modify has not been applied either
This patch is provided by the composer.json of Media Contextual Crop Reference
"patches": { "drupal/media_library_media_modify": { "#3270150 Add alteration": "https://www.drupal.org/files/issues/2022-06-08/manage_crops_3270150-7.patch" } }
- π©πͺGermany jox
You are right. My
composer-patches
wasn't configured properly. I fixed that and now all patches are applied. It did even reinstall core to also apply "Issue #3263397-10: Simplify form logic in media library".Now one thing is fixed: It saves my crop configuration!
But I still got these issues left:
- In the image modal there is a warning "This crop definition affects more usages of this image".
- I cannot see any preview for my crop selection.
Is this what I have to expect? Thanks!
- π«π·France DrDam
In the image modal there is a warning "This crop definition affects more usages of this image".
For the first point, I have push an update on media_contextual_crop_iwc_adapter to alter messages.
I cannot see any preview for my crop selection.
This "bug" aren't in my hands, if you use a croped media with a classique media_reference field, you will have the same result.
Please ask to Image_widget_crop module mainteners - Status changed to Fixed
10 months ago 1:12pm 24 January 2024