protected function applyCrops(array $item, FileInterface $entity) {
    // Add coordinates for cropping images.
    foreach ($item['crops'] as $crop_name => $data) {
      $crop_type = $this->entityTypeManager
        ->getStorage('crop_type')
        ->load($crop_name);

      if (!empty($crop_type) && $crop_type instanceof CropType) {
        $this->imageWidgetCropManager->applyCrop($data, [
          'file-uri' => $item['uri'],
          'file-id' => $entity->id(),
        ], $crop_type);
      }
    }
  }
protected function applyCrops(array $item, FileInterface $entity) {
    // Add coordinates for cropping images.
    foreach ($item['crops'] as $crop_name => $data) {
      $crop_type = $this->entityTypeManager
        ->getStorage('crop_type')
        ->load($crop_name);

      if (!empty($crop_type) && $crop_type instanceof CropType) {
        $this->imageWidgetCropManager->applyCrop($data, [
          'file-uri' => $item['uri'],
          'file-id' => $entity->id(),
        ], $crop_type);
      }
    }
  }
protected function applyCrops ( array $ item , FileInterface $ entity ) { // Add coordinates for cropping images. foreach ( $ item [ 'crops' ] as $ crop_name => $ data ) { $ crop_type = $ this -> entityTypeManager -> getStorage ( 'crop_type' ) -> load ( $ crop_name ) ; if ( ! empty ( $ crop_type ) && $ crop_type instanceof CropType ) { $ this -> imageWidgetCropManager -> applyCrop ( $ data , [ 'file-uri' => $ item [ 'uri' ] , 'file-id' => $ entity -> id ( ) , ] , $ crop_type ) ; } } }
Crops the images.

@param array $item
The array with items.
@param \Drupal\file\FileInterface $entity
The FileInterface entity.
Crops the images .