You are here

class DefaultParagraphsAddEvent in Default Paragraphs 8

Represents Paragraph Entity adding as default.

Hierarchy

Expanded class hierarchy of DefaultParagraphsAddEvent

1 file declares its use of DefaultParagraphsAddEvent
DefaultParagraphsWidget.php in src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php

File

src/Events/DefaultParagraphsAddEvent.php, line 11

Namespace

Drupal\default_paragraphs\Events
View source
class DefaultParagraphsAddEvent extends Event {

  /**
   * The paragraph entity being added.
   *
   * @var \Drupal\paragraphs\ParagraphInterface
   */
  protected $paragraphEntity;

  /**
   * The bundle of the paragraph entity.
   *
   * @var string
   */
  private $targetBundle;

  /**
   * DefaultParagraphsAddEvent constructor.
   *
   * @param \Drupal\paragraphs\ParagraphInterface $paragraph_entity
   *   The paragraph entity being created.
   * @param string $target_bundle
   *   The bundle, which the paragraph is referenced to.
   */
  public function __construct(ParagraphInterface $paragraph_entity, $target_bundle) {
    $this->paragraphEntity = $paragraph_entity;
    $this->targetBundle = $target_bundle;
  }

  /**
   * Get the paragraph entity.
   *
   * @return \Drupal\paragraphs\ParagraphInterface
   *   A paragraph entity.
   */
  public function getParagraphEntity() {
    return $this->paragraphEntity;
  }

  /**
   * Get the paragraph's bundle.
   *
   * @return string
   *   A paragraph entity's bundle.
   */
  public function getTargetBundle() {
    return $this->targetBundle;
  }

  /**
   * Set the paragraph entity.
   *
   * @param \Drupal\paragraphs\paragraphInterface $paragraph_entity
   *   The updated paragraph entity.
   */
  public function setParagraphEntity(paragraphInterface $paragraph_entity) {
    $this->paragraphEntity = $paragraph_entity;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultParagraphsAddEvent::$paragraphEntity protected property The paragraph entity being added.
DefaultParagraphsAddEvent::$targetBundle private property The bundle of the paragraph entity.
DefaultParagraphsAddEvent::getParagraphEntity public function Get the paragraph entity.
DefaultParagraphsAddEvent::getTargetBundle public function Get the paragraph's bundle.
DefaultParagraphsAddEvent::setParagraphEntity public function Set the paragraph entity.
DefaultParagraphsAddEvent::__construct public function DefaultParagraphsAddEvent constructor.