public function Email::validate in JS Callback Handler 8.3
Validates the callback.
Parameters
mixed ...: Any number of arguments can be passed here.
Return value
mixed The content to return.
Overrides JsCallbackBase::validate
File
- js_callback_examples/
src/ Plugin/ Js/ Email.php, line 23
Class
- Plugin annotation @JsCallback( id = "js_callback_examples.email", parameters = { "user" = { "type" = "entity:user" }, }, )
Namespace
Drupal\js_callback_examples\Plugin\JsCode
public function validate(UserInterface $user = NULL) {
if (!$user || !$user
->isActive()) {
drupal_set_message(t('You must enter a valid user.'), 'error');
return FALSE;
}
return TRUE;
}