public function YamlFormElementController::close in YAML Form 8
Returns response for message close using user or state storage.
Parameters
string $storage: Mechanism that the message state should be stored in, user or state.
string $id: The unique id of the message.
Return value
\Drupal\Core\Ajax\AjaxResponse An empty AJAX response.
Throws
\Exception Throws exception is storage is not set to 'user' or 'state'.
See also
\Drupal\yamlform\Element\YamlFormMessage::setClosed
1 string reference to 'YamlFormElementController::close'
File
- src/
Controller/ YamlFormElementController.php, line 36
Class
- YamlFormElementController
- Provides route responses for form element.
Namespace
Drupal\yamlform\ControllerCode
public function close($storage, $id) {
if (!in_array($storage, [
'user',
'state',
])) {
throw new \Exception('Undefined storage mechanism for YAML Form close message.');
}
YamlFormMessage::setClosed($storage, $id);
return new AjaxResponse();
}