You are here

public function Email::execute in JS Callback Handler 8.3

Executes the callback.

Parameters

mixed ...: Any number of arguments can be passed here.

Return value

mixed The content to return.

Overrides JsCallbackInterface::execute

File

js_callback_examples/src/Plugin/Js/Email.php, line 35

Class

Email
Plugin annotation @JsCallback( id = "js_callback_examples.email", parameters = { "user" = { "type" = "entity:user" }, }, )

Namespace

Drupal\js_callback_examples\Plugin\Js

Code

public function execute(UserInterface $user = NULL) {
  return [
    '#markup' => $user
      ->getEmail(),
    '#attached' => [
      'drupalSettings' => [
        'testing' => 'test',
      ],
    ],
  ];
}