You are here

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\Events
View 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

Namesort descending Modifiers Type Description Overrides
AutomaticCrop::$configuration protected property All data required by crop providers.
AutomaticCrop::$crop protected property The crop entity.
AutomaticCrop::$cropType protected property The crop type loaded.
AutomaticCrop::$image protected property The image resource to crop.
AutomaticCrop::getConfiguration public function Get all configurations to generate automatic crop.
AutomaticCrop::getCrop public function Get crop instance.
AutomaticCrop::getCropType public function Get the crop type entity.
AutomaticCrop::getImage public function Get image to crop.
AutomaticCrop::setCrop public function Set calculated crop instance.
AutomaticCrop::__construct public function Constructs a EntitySelectionEvent object.