What exactly makes a Crop Type appear in the field widget?

Created on 8 April 2025, 4 months ago

Problem/Motivation

What part of setup actually makes the Crop Types show up on the field widget? I can't pin down the exact moment that this is supposed to happen? It doesn't seem to show them when I create the crop types, or when I add them to image styles. Is there a way to force a rescan? Is it supposed to be linked somewhere?

Can someone outline the exact steps it would take to get a new crop type to appear in the list?

Steps to reproduce

1. Activate module (Image Widget Crop 3.0.0)
2. Create crop type ("Manual 1:1")
3. Add crop type to Image Style ("Manual crop uses Manual 1:1 crop type")
4. Configure "Image" media type to use ImageWidget crop field widget.
5. Crop types do not display in list.

Proposed resolution

Better document the setup of this module so that someone can configure it from scratch.

πŸ’¬ Support request
Status

Active

Version

3.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States nessthehero

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

Comments & Activities

  • Issue created by @nessthehero
  • πŸ‡ΊπŸ‡ΈUnited States nessthehero

    Okay, I dug into the code a bit.

    I think the issue is partly my fault. I have an existing Focal point crop on every image style, and the code is stopping after it finds one crop in each image style.

    This takes place in \Drupal\image_widget_crop\ImageWidgetCropManager::getEffectData;

    It sets data every time it finds a crop, so whichever one comes last is the winner.

    Maybe this should return an array? Then the final return would be a reduced array of all the unique crop types.

    I can resolve the issue on my end by replacing the Focal crop with the Manual crop and then just using a Scale afterwards to get the size I want, but I'm curious on the approach I mentioned above. Would it prove useful?

    Thanks.

Production build 0.71.5 2024