Problem/Motivation

In the CROP entity code, the use of the ‘crop_crop’ effect plugin is hard-coded at several key points in the process. Introducing complexity into the code, it takes the form of :

if(is_crop_crop) {
 do something
}
else {
 do something, but almost the same
}

The main problem this creates is that for retrieving the Crop Type in the ‘getCropFromImageStyleId’ method, only the ‘crop_crop’ plugin is allowed to have a selection of the Crop type, in all other cases the ‘Crop type’ must correspond to the Provider (the module) declaring the effect plugin.

Steps to reproduce

NA

Proposed resolution

It would be preferable to do away with these special cases and use the crop_crop plugin as the basis/template for implementing other CROP-based effect plugins.

Remaining tasks

Documentation :
- Specify that any effect plugin wishing to allow selection of the crop type must store this value in a storage named ‘crop_type’.

User interface changes

NA

API changes

All

Data model changes

NA

CommentFileSizeAuthor
#2 3464677-2.patch2.07 KBdrdam

Issue fork crop-3464677

Command icon 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

DrDam created an issue. See original summary.

drdam’s picture

StatusFileSize
new2.07 KB
drdam’s picture

Status: Active » Needs review

drdam’s picture

Status: Needs review » Reviewed & tested by the community
nikolay shapovalov’s picture

Status: Reviewed & tested by the community » Needs review

Thanks for your MR, but I believe this issue still need review.
I hide patch file, because MR approach used.

There is 2 issue related on this topic.
And at first sight it looks like methods: getCropFromImageStyle, getCropFromImageStyleId, cropExists, findCrop should be moved away from CropInterface. Maybe we need to make bigger refactor to impove developers expirience.

drdam’s picture

And at first sight it looks like methods: getCropFromImageStyle, getCropFromImageStyleId, cropExists, findCrop should be moved away from CropInterface. Maybe we need to make bigger refactor to impove developers expirience.

I totaly agree, but without knowing the history of the implementation, it's not clear how far the refactor can go.