class WebformElementAlterEvent in Hook Event Dispatcher 8
Same name and namespace in other branches
- 8.2 modules/webform_event_dispatcher/src/Event/WebformElement/WebformElementAlterEvent.php \Drupal\webform_event_dispatcher\Event\WebformElement\WebformElementAlterEvent
- 3.x modules/webform_event_dispatcher/src/Event/WebformElement/WebformElementAlterEvent.php \Drupal\webform_event_dispatcher\Event\WebformElement\WebformElementAlterEvent
Class WebformElementAlterEvent.
@package Drupal\webform_event_dispatcher\Event\Element
Hierarchy
- class \Drupal\webform_event_dispatcher\Event\WebformElement\WebformElementAlterEvent extends \Symfony\Component\EventDispatcher\Event implements EventInterface
Expanded class hierarchy of WebformElementAlterEvent
2 files declare their use of WebformElementAlterEvent
- WebformElementEventTest.php in modules/
webform_event_dispatcher/ tests/ src/ Unit/ WebformElement/ WebformElementEventTest.php - webform_event_dispatcher.module in modules/
webform_event_dispatcher/ webform_event_dispatcher.module - Webform event dispatcher submodule.
File
- modules/
webform_event_dispatcher/ src/ Event/ WebformElement/ WebformElementAlterEvent.php, line 15
Namespace
Drupal\webform_event_dispatcher\Event\WebformElementView source
class WebformElementAlterEvent extends Event implements EventInterface {
/**
* The webform element.
*
* @var array
*/
private $element;
/**
* The form state.
*
* @var \Drupal\Core\Form\FormStateInterface
*/
private $formState;
/**
* The context.
*
* @var array
*/
private $context;
/**
* WebformElementAlterEvent constructor.
*
* @param array $element
* The webform element.
* @param \Drupal\Core\Form\FormStateInterface $formState
* The current state of the form.
* @param array $context
* An associative array containing the following key-value pairs:
* - form: The form structure to which elements is being attached.
*/
public function __construct(array &$element, FormStateInterface $formState, array $context) {
$this->element =& $element;
$this->formState = $formState;
$this->context = $context;
}
/**
* Get the webform element.
*
* @return array
* The element.
*/
public function &getElement() {
return $this->element;
}
/**
* Get the webform element type.
*
* @return string
* The webform element type.
*/
public function getElementType() {
return $this
->getElement()['#type'];
}
/**
* Get the form state.
*
* @return \Drupal\Core\Form\FormStateInterface
* The form state.
*/
public function getFormState() {
return $this->formState;
}
/**
* Get the context.
*
* @return array
* The context.
*/
public function getContext() {
return $this->context;
}
/**
* {@inheritdoc}
*/
public function getDispatcherType() {
return HookEventDispatcherInterface::WEBFORM_ELEMENT_ALTER;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformElementAlterEvent:: |
private | property | The context. | |
WebformElementAlterEvent:: |
private | property | The webform element. | |
WebformElementAlterEvent:: |
private | property | The form state. | |
WebformElementAlterEvent:: |
public | function | Get the context. | |
WebformElementAlterEvent:: |
public | function |
Get the dispatcher type. Overrides EventInterface:: |
1 |
WebformElementAlterEvent:: |
public | function | Get the webform element. | |
WebformElementAlterEvent:: |
public | function | Get the webform element type. | |
WebformElementAlterEvent:: |
public | function | Get the form state. | |
WebformElementAlterEvent:: |
public | function | WebformElementAlterEvent constructor. |