You are here

public function ExampleEventSubscriber::onWebformNodeElementPreRender in Webform Node Element 8

This is called whenever the webform_node_element prerender event occurs.

For example purposes we tell the element to display node 1 using the 'teaser' display mode.

Parameters

\WebformNodeElementPreRender $event: The event that triggered this callback.

File

modules/webform_node_element_example/src/EventSubscriber/ExampleEventSubscriber.php, line 40

Class

ExampleEventSubscriber
Class ExampleEventSubscriber.

Namespace

Drupal\webform_node_element_example\EventSubscriber

Code

public function onWebformNodeElementPreRender(WebformNodeElementPreRender $event) {
  $event
    ->setNid(1);
  $event
    ->setDisplayMode('teaser');
}