class AutomaticCrop in Crop API 8.2
Represents automatic crop action as event.
Hierarchy
- class \Drupal\crop\Events\AutomaticCrop extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of AutomaticCrop
1 file declares its use of AutomaticCrop
- CropEffect.php in src/
Plugin/ ImageEffect/ CropEffect.php
File
- src/
Events/ AutomaticCrop.php, line 13
Namespace
Drupal\crop\EventsView source
class AutomaticCrop extends Event {
/**
* The crop entity.
*
* @var \Drupal\crop\CropInterface|false
*/
protected $crop = FALSE;
/**
* The image resource to crop.
*
* @var \Drupal\Core\Image\ImageInterface
*/
protected $image;
/**
* The crop type loaded.
*
* @var \Drupal\crop\Entity\CropType
*/
protected $cropType;
/**
* All data required by crop providers.
*
* @var array
*/
protected $configuration;
/**
* Constructs a EntitySelectionEvent object.
*
* @param \Drupal\Core\Image\ImageInterface $image
* @param \Drupal\crop\Entity\CropType $cropType
* @param $configuration
*/
public function __construct(ImageInterface $image, CropType $cropType, array $configuration) {
$this->image = $image;
$this->cropType = $cropType;
$this->configuration = $configuration;
}
/**
* Set calculated crop instance.
*
* @param \Drupal\crop\CropInterface $crop
* The crop entity instance.
*/
public function setCrop(CropInterface $crop) {
$this->crop = $crop;
}
/**
* Get crop instance.
*
* @return \Drupal\crop\CropInterface|false
* List of fallbacks.
*/
public function getCrop() {
return $this->crop;
}
/**
* Get the crop type entity.
*
* @return \Drupal\crop\Entity\CropType
* The crop type entity loaded.
*/
public function getCropType() {
return $this->cropType;
}
/**
* Get image to crop.
*
* @return \Drupal\Core\Image\ImageInterface
* The image resource.
*/
public function getImage() {
return $this->image;
}
/**
* Get all configurations to generate automatic crop.
*
* @return array
* All data to be used by automatic crop providers.
*/
public function getConfiguration() {
return $this->configuration;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AutomaticCrop:: |
protected | property | All data required by crop providers. | |
AutomaticCrop:: |
protected | property | The crop entity. | |
AutomaticCrop:: |
protected | property | The crop type loaded. | |
AutomaticCrop:: |
protected | property | The image resource to crop. | |
AutomaticCrop:: |
public | function | Get all configurations to generate automatic crop. | |
AutomaticCrop:: |
public | function | Get crop instance. | |
AutomaticCrop:: |
public | function | Get the crop type entity. | |
AutomaticCrop:: |
public | function | Get image to crop. | |
AutomaticCrop:: |
public | function | Set calculated crop instance. | |
AutomaticCrop:: |
public | function | Constructs a EntitySelectionEvent object. |