You are here

public function ImageWidgetCropManager::getAvailableCropType in Image Widget Crop 8

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

Verify if the crop is used by a ImageStyle.

Parameters

array $crop_list: The list of existent Crop Type.

Return value

array<integer> The list of Crop Type filtred.

File

src/ImageWidgetCropManager.php, line 417

Class

ImageWidgetCropManager
ImageWidgetCropManager calculation class.

Namespace

Drupal\image_widget_crop

Code

public function getAvailableCropType(array $crop_list) {
  $available_crop = [];
  foreach ($crop_list as $crop_machine_name => $crop_label) {
    $image_styles = $this
      ->getImageStylesByCrop($crop_machine_name);
    if (!empty($image_styles)) {
      $available_crop[$crop_machine_name] = $crop_label;
    }
  }
  return $available_crop;
}