You are here

public function MessageController::add in Message UI 8

Generates form output for adding a new message entity of message_template.

Parameters

\Drupal\message\MessageTemplateInterface $message_template: The message template object.

Return value

array An array as expected by drupal_render().

1 string reference to 'MessageController::add'
message_ui.routing.yml in ./message_ui.routing.yml
message_ui.routing.yml

File

src/Controller/MessageController.php, line 77

Class

MessageController
Controller for adding messages.

Namespace

Drupal\message_ui\Controller

Code

public function add(MessageTemplateInterface $message_template) {
  $message = Message::create([
    'template' => $message_template
      ->id(),
  ]);
  $form = $this
    ->entityFormBuilder()
    ->getForm($message);
  return $form;
}