You are here

class DropzoneMediaEntityCreateEvent in DropzoneJS 8

Same name and namespace in other branches
  1. 8.2 src/Events/DropzoneMediaEntityCreateEvent.php \Drupal\dropzonejs\Events\DropzoneMediaEntityCreateEvent

Represents Media Entity creation as an event when using DropzoneJS.

Hierarchy

Expanded class hierarchy of DropzoneMediaEntityCreateEvent

2 files declare their use of DropzoneMediaEntityCreateEvent
InlineEntityFormMediaWidget.php in modules/eb_widget/src/Plugin/EntityBrowser/Widget/InlineEntityFormMediaWidget.php
MediaEntityDropzoneJsEbWidget.php in modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php

File

src/Events/DropzoneMediaEntityCreateEvent.php, line 13

Namespace

Drupal\dropzonejs\Events
View source
class DropzoneMediaEntityCreateEvent extends Event {

  /**
   * The media entity being created.
   *
   * @var \Drupal\media_entity\MediaInterface
   */
  protected $mediaEntity;

  /**
   * The file that will be used for the media entity.
   *
   * @var \Drupal\file\FileInterface
   */
  protected $file;

  /**
   * The form that contains the Dropzone element.
   *
   * @var array
   */
  protected $form;

  /**
   * The form state.
   *
   * @var \Drupal\Core\Form\FormStateInterface
   */
  protected $formState;

  /**
   * The Dropzone form element.
   *
   * @var array
   */
  protected $element;

  /**
   * DropzoneMediaEntityCreateEvent constructor.
   *
   * @param \Drupal\media_entity\MediaInterface $media_entity
   *   The media entity being created.
   * @param \Drupal\file\FileInterface $file
   *   The file that will be used for the media entity.
   * @param array $form
   *   The form that contains the Dropzone element.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state.
   * @param array $element
   *   The Dropzone form element.
   */
  public function __construct(MediaInterface $media_entity, FileInterface $file, array $form, FormStateInterface $form_state, array $element) {
    $this->mediaEntity = $media_entity;
    $this->file = $file;
    $this->form = $form;
    $this->formState = $form_state;
    $this->element = $element;
  }

  /**
   * Get the media entity.
   *
   * @return \Drupal\media_entity\MediaInterface
   *   A media entity.
   */
  public function getMediaEntity() {
    return $this->mediaEntity;
  }

  /**
   * Set the media entity.
   *
   * @param \Drupal\media_entity\MediaInterface $media_entity
   *   The updated media entity.
   */
  public function setMediaEntity(MediaInterface $media_entity) {
    $this->mediaEntity = $media_entity;
  }

  /**
   * Get the file for the media entity.
   *
   * @return \Drupal\file\FileInterface
   *   The file that will be used for the media entity.
   */
  public function getFile() {
    return $this->file;
  }

  /**
   * Get the form that contains the Dropzone element.
   *
   * @return array
   *    The form that contains the Dropzone element.
   */
  public function getForm() {
    return $this->form;
  }

  /**
   * Get the form state.
   *
   * @return \Drupal\Core\Form\FormStateInterface
   *    The current formstate.
   */
  public function getFormState() {
    return $this->formState;
  }

  /**
   * Set the form state.
   *
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The updated form state.
   */
  public function setFormState(FormStateInterface $form_state) {
    $this->formState = $form_state;
  }

  /**
   * Get the Dropzone form element.
   *
   * @return array
   *    The dropzone element.
   */
  public function getElement() {
    return $this->element;
  }

  /**
   * Set the Dropzone form element.
   *
   * @param array $element
   *   The updated form element.
   */
  public function setElement(array $element) {
    $this->element = $element;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DropzoneMediaEntityCreateEvent::$element protected property The Dropzone form element.
DropzoneMediaEntityCreateEvent::$file protected property The file that will be used for the media entity.
DropzoneMediaEntityCreateEvent::$form protected property The form that contains the Dropzone element.
DropzoneMediaEntityCreateEvent::$formState protected property The form state.
DropzoneMediaEntityCreateEvent::$mediaEntity protected property The media entity being created.
DropzoneMediaEntityCreateEvent::getElement public function Get the Dropzone form element.
DropzoneMediaEntityCreateEvent::getFile public function Get the file for the media entity.
DropzoneMediaEntityCreateEvent::getForm public function Get the form that contains the Dropzone element.
DropzoneMediaEntityCreateEvent::getFormState public function Get the form state.
DropzoneMediaEntityCreateEvent::getMediaEntity public function Get the media entity.
DropzoneMediaEntityCreateEvent::setElement public function Set the Dropzone form element.
DropzoneMediaEntityCreateEvent::setFormState public function Set the form state.
DropzoneMediaEntityCreateEvent::setMediaEntity public function Set the media entity.
DropzoneMediaEntityCreateEvent::__construct public function DropzoneMediaEntityCreateEvent constructor.