You are here

protected function CropEffect::getCrop in Crop API 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/ImageEffect/CropEffect.php \Drupal\crop\Plugin\ImageEffect\CropEffect::getCrop()

Gets crop entity for the image.

Parameters

\Drupal\Core\Image\ImageInterface $image: Image object.

Return value

\Drupal\Core\Entity\EntityInterface|\Drupal\crop\CropInterface|false Crop entity or FALSE if crop doesn't exist.

1 call to CropEffect::getCrop()
CropEffect::applyEffect in src/Plugin/ImageEffect/CropEffect.php
Applies an image effect to the image object.

File

src/Plugin/ImageEffect/CropEffect.php, line 169

Class

CropEffect
Crops an image resource.

Namespace

Drupal\crop\Plugin\ImageEffect

Code

protected function getCrop(ImageInterface $image) {
  if (!isset($this->crop)) {
    $this->crop = FALSE;
    if ($crop = Crop::findCrop($image
      ->getSource(), $this->configuration['crop_type'])) {
      $this->crop = $crop;
    }
  }
  return $this->crop;
}