panopoly_magic-8.x-2.x-dev/src/Event/PanopolyMagicLivePreviewEvent.php
src/Event/PanopolyMagicLivePreviewEvent.php
<?php
namespace Drupal\panopoly_magic\Event;
use Drupal\Component\EventDispatcher\Event;
use Drupal\layout_builder\SectionComponent;
/**
* Event that is dispatched when a live preview is generated.
*/
class PanopolyMagicLivePreviewEvent extends Event {
/**
* Block plugin ID.
*
* @var string
*/
protected $blockPluginId;
/**
* Block configuration.
*
* @var array
*/
protected $blockConfiguration;
/**
* The preview render array.
*
* @var array
*/
protected $preview;
/**
* The section component.
*
* @var \Drupal\layout_builder\SectionComponent
*/
protected $sectionComponent;
/**
* Form values that were submitted for the preview.
*
* @var array
*/
protected $formValues;
/**
* Constructs a PanopolyMagicLivePreviewEvent.
*
* @param string $plugin_id
* The block plugin id.
* @param array $configuration
* The block configuration.
* @param array $preview
* The block preview render array.
* @param \Drupal\layout_builder\SectionComponent $section_component
* The section component.
* @param array $form_values
* The form values.
*/
public function __construct($plugin_id, array $configuration, array $preview, SectionComponent $section_component, array $form_values) {
$this->blockPluginId = $plugin_id;
$this->blockConfiguration = $configuration;
$this->preview = $preview;
$this->sectionComponent = $section_component;
$this->formValues = $form_values;
}
/**
* Gets the block plugin ID.
*/
public function getBlockPluginId() {
return $this->blockPluginId;
}
/**
* Gets the block configuration.
*/
public function getBlockConfiguration() {
return $this->blockConfiguration;
}
/**
* Gets the block preview render array.
*/
public function getPreview() {
return $this->preview;
}
/**
* Sets the block preview render array.
*
* @param array $preview
* Block preview render array.
*/
public function setPreview(array $preview) {
$this->preview = $preview;
}
/**
* Gets the section component.
*/
public function getSectionComponent() {
return $this->sectionComponent;
}
/**
* Gets the form values that were submitted for the preview.
*/
public function getFormValues() {
return $this->formValues;
}
}
