You are here

public static function Crop::findCrop in Crop API 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Crop.php \Drupal\crop\Entity\Crop::findCrop()

Loads crop based on image URI and crop type.

Parameters

string $uri: URI of the image.

string $type: Crop type.

Return value

\Drupal\crop\CropInterface|null Crop entity or NULL if crop doesn't exist.

Overrides CropInterface::findCrop

4 calls to Crop::findCrop()
Crop::getCropFromImageStyle in src/Entity/Crop.php
Retrieve crop from given image style.
CropCRUDTest::testCropSave in tests/src/Kernel/CropCRUDTest.php
Tests crop save.
CropEffect::getCrop in src/Plugin/ImageEffect/CropEffect.php
Gets crop entity for the image.
CropEffect::transformDimensions in src/Plugin/ImageEffect/CropEffect.php
Determines the dimensions of the styled image.

File

src/Entity/Crop.php, line 137

Class

Crop
Defines the crop entity class.

Namespace

Drupal\crop\Entity

Code

public static function findCrop($uri, $type) {
  return \Drupal::entityTypeManager()
    ->getStorage('crop')
    ->getCrop($uri, $type);
}