public function ExamplePreprocessEventSubscriber::preprocessArticleFull in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x examples/ExamplePreprocessEventSubscriber.php \Drupal\hook_event_dispatcher\ExamplePreprocessEventSubscriber::preprocessArticleFull()
Preprocess a node with bundle type article in view mode full.
Parameters
\Drupal\preprocess_event_dispatcher\Event\NodePreprocessEvent $event: Event.
File
- examples/
ExamplePreprocessEventSubscriber.php, line 41
Class
- ExamplePreprocessEventSubscriber
- Class ExamplePreprocessorEventSubscriber.
Namespace
Drupal\hook_event_dispatcherCode
public function preprocessArticleFull(NodePreprocessEvent $event) : void {
/** @var \Drupal\preprocess_event_dispatcher\Variables\NodeEventVariables $variables */
$variables = $event
->getVariables();
$node = $variables
->getNode();
$someField = $node
->get('field_some_field')
->view();
$variables
->set('some_field', $someField);
}