You are here

public static function ImageWidgetCropManager::getCropProperties in Image Widget Crop 8

Same name and namespace in other branches
  1. 8.2 src/ImageWidgetCropManager.php \Drupal\image_widget_crop\ImageWidgetCropManager::getCropProperties()

Get All sizes properties of the crops for an file.

Parameters

\Drupal\crop\Entity\Crop $crop: All crops attached to this file based on URI.

Return value

array<array> Get all crop zone properties (x, y, height, width),

File

src/ImageWidgetCropManager.php, line 438

Class

ImageWidgetCropManager
ImageWidgetCropManager calculation class.

Namespace

Drupal\image_widget_crop

Code

public static function getCropProperties(Crop $crop) {
  $anchor = $crop
    ->anchor();
  $size = $crop
    ->size();
  return [
    'x' => $anchor['x'],
    'y' => $anchor['y'],
    'height' => $size['height'],
    'width' => $size['width'],
  ];
}