public function ImageWidgetCropManager::applyCrop in Image Widget Crop 8.2
Same name and namespace in other branches
- 8 src/ImageWidgetCropManager.php \Drupal\image_widget_crop\ImageWidgetCropManager::applyCrop()
Create new crop entity with user properties.
Parameters
array $properties: All properties returned by the crop plugin (js), and the size of thumbnail image.
array|mixed $field_value: An array of values for the contained properties of image_crop widget.
\Drupal\crop\Entity\CropType $crop_type: The entity CropType.
Overrides ImageWidgetCropInterface::applyCrop
2 calls to ImageWidgetCropManager::applyCrop()
- ImageWidgetCropManager::buildCropToEntity in src/
ImageWidgetCropManager.php - Fetch all fields FileField and use "image_crop" element on an entity.
- ImageWidgetCropManager::buildCropToForm in src/
ImageWidgetCropManager.php - Fetch all form elements using image_crop element.
File
- src/
ImageWidgetCropManager.php, line 90
Class
- ImageWidgetCropManager
- ImageWidgetCropManager calculation class.
Namespace
Drupal\image_widget_cropCode
public function applyCrop(array $properties, $field_value, CropType $crop_type) {
$crop_properties = $this
->getCropOriginalDimension($field_value, $properties);
if (!empty($crop_properties)) {
$this
->saveCrop($crop_properties, $field_value, $crop_type, $this->imageWidgetCropSettings
->get('settings.notify_apply'));
}
}