text = $text; $this->priority = $priority; } /** * {@inheritdoc} */ public function render() { $render = [ 'command' => 'announce', 'text' => $this->text, ]; if ($this->priority !== NULL) { $render['priority'] = $this->priority; } return $render; } /** * {@inheritdoc} */ public function getAttachedAssets() { $assets = new AttachedAssets(); $assets->setLibraries(['core/drupal.announce']); return $assets; } }