You are here

class LayoutParagraphsEventCommand in Layout Paragraphs 2.0.x

Class ExampleCommand.

Hierarchy

Expanded class hierarchy of LayoutParagraphsEventCommand

3 files declare their use of LayoutParagraphsEventCommand
DeleteComponentForm.php in src/Form/DeleteComponentForm.php
EditComponentForm.php in src/Form/EditComponentForm.php
InsertComponentForm.php in src/Form/InsertComponentForm.php
1 string reference to 'LayoutParagraphsEventCommand'
LayoutParagraphsEventCommand::render in src/Ajax/LayoutParagraphsEventCommand.php
Render custom ajax command.

File

src/Ajax/LayoutParagraphsEventCommand.php, line 10

Namespace

Drupal\layout_paragraphs\Ajax
View source
class LayoutParagraphsEventCommand implements CommandInterface {

  /**
   * The layout object.
   *
   * @var \Drupal\layout_paragraphs\LayoutParagraphsLayout
   */
  protected $layout;

  /**
   * The component uuid.
   *
   * @var string
   */
  protected $componentUuid;

  /**
   * The event to trigger.
   *
   * @var string
   */
  protected $eventName;

  /**
   * Constructor.
   */
  public function __construct($layout, $component_uuid, $event_name) {
    $this->layout = $layout;
    $this->componentUuid = $component_uuid;
    $this->eventName = $event_name;
  }

  /**
   * Render custom ajax command.
   *
   * @return array
   *   The command array.
   */
  public function render() {
    return [
      'command' => 'LayoutParagraphsEventCommand',
      'layoutId' => $this->layout
        ->id(),
      'componentUuid' => $this->componentUuid,
      'eventName' => $this->eventName,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LayoutParagraphsEventCommand::$componentUuid protected property The component uuid.
LayoutParagraphsEventCommand::$eventName protected property The event to trigger.
LayoutParagraphsEventCommand::$layout protected property The layout object.
LayoutParagraphsEventCommand::render public function Render custom ajax command. Overrides CommandInterface::render
LayoutParagraphsEventCommand::__construct public function Constructor.