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
- Plugin annotation @JsCallback( id = "js_callback_examples.email", parameters = { "user" = { "type" = "entity:user" }, }, )
Namespace
Drupal\js_callback_examples\Plugin\JsCode
public function execute(UserInterface $user = NULL) {
return [
'#markup' => $user
->getEmail(),
'#attached' => [
'drupalSettings' => [
'testing' => 'test',
],
],
];
}