5 use Drupal\Core\Entity\ContentEntityInterface;
8 * Provides an interface defining the crop entity.
10 interface CropInterface extends ContentEntityInterface {
13 * Gets position of crop's center.
16 * Array with two keys (x, y) and center coordinates as values.
18 public function position();
21 * Sets position of crop's center.
24 * X coordinate of the crop's center.
26 * Y coordinate of the crop's center.
28 * @return \Drupal\crop\CropInterface
29 * Crop object this is being called on.
31 public function setPosition($x, $y);
37 * Array with two keys (width, height) each side dimensions as values.
39 public function size();
49 * @return \Drupal\crop\CropInterface
50 * Crop object this is being called on.
52 public function setSize($width, $height);
55 * Gets crop anchor (top-left corner of crop area).
58 * Array with two keys (x, y) and anchor coordinates as values.
60 public function anchor();
63 * Gets entity provider for the crop.
65 * @return \Drupal\crop\EntityProviderInterface
68 * @throws \Drupal\crop\EntityProviderNotFoundException
69 * Thrown if entity provider not found.
71 public function provider();
74 * Checks whether crop exists for an image.
77 * URI of image to check for.
79 * (Optional) Type of crop. Function will check across all available types
83 * Boolean TRUE if crop exists and FALSE if not.
85 public static function cropExists($uri, $type = NULL);
88 * Loads crop based on image URI and crop type.
95 * @return \Drupal\crop\CropInterface|null
96 * Crop entity or NULL if crop doesn't exist.
98 public static function findCrop($uri, $type);