class WebformNodeElementPreRender in Webform Node Element 8
Event dispatched prior to each webform_node_element being rendered.
This gives other modules a chance to dynamically set the nid and display mode of the node being rendered.
Hierarchy
- class \Drupal\webform_node_element\Event\WebformNodeElementPreRender extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of WebformNodeElementPreRender
2 files declare their use of WebformNodeElementPreRender
- ExampleEventSubscriber.php in modules/
webform_node_element_example/ src/ EventSubscriber/ ExampleEventSubscriber.php - WebformNodeElement.php in src/
Element/ WebformNodeElement.php
File
- src/
Event/ WebformNodeElementPreRender.php, line 13
Namespace
Drupal\webform_node_element\EventView source
class WebformNodeElementPreRender extends Event {
const PRERENDER = 'webform_node_element.pre_render';
protected $elementID = NULL;
protected $nid = NULL;
protected $displayMode = NULL;
/**
* Constructor.
*/
public function __construct($element_id, $nid, $display_mode) {
$this
->setNid($nid);
$this->elementID = $element_id;
$this
->setDisplayMode($display_mode);
}
/**
* Set the nid of the node to display.
*
* @param int $nid
* The nid of the node to display.
*/
public function setNid($nid) {
$this->nid = $nid;
}
/**
* Get the nid of the node to display.
*
* @return int
* The nid of the node to display.
*/
public function getNid() {
return $this->nid;
}
/**
* Set the display mode to use to render the node.
*
* @param string $display_mode
* The machine name of the display mode to use.
*/
public function setDisplayMode($display_mode) {
$this->displayMode = $display_mode;
}
/**
* Get the display mode to use to render the node.
*
* @return string
* The machine name of the display mode to use.
*/
public function getDisplayMode() {
return $this->displayMode;
}
/**
* Get the element id that is being rendered.
*
* @return string
* The id of the element being rendered.
*/
public function getElementId() {
return $this->elementId;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WebformNodeElementPreRender:: |
protected | property | ||
WebformNodeElementPreRender:: |
protected | property | ||
WebformNodeElementPreRender:: |
protected | property | ||
WebformNodeElementPreRender:: |
public | function | Get the display mode to use to render the node. | |
WebformNodeElementPreRender:: |
public | function | Get the element id that is being rendered. | |
WebformNodeElementPreRender:: |
public | function | Get the nid of the node to display. | |
WebformNodeElementPreRender:: |
constant | |||
WebformNodeElementPreRender:: |
public | function | Set the display mode to use to render the node. | |
WebformNodeElementPreRender:: |
public | function | Set the nid of the node to display. | |
WebformNodeElementPreRender:: |
public | function | Constructor. |