public function ContentElementController::close in Content Synchronization 8.2
Same name and namespace in other branches
- 8 src/Controller/ContentElementController.php \Drupal\content_sync\Controller\ContentElementController::close()
- 3.0.x src/Controller/ContentElementController.php \Drupal\content_sync\Controller\ContentElementController::close()
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\content_sync\Element\ContentSyncMessage::setClosed
1 string reference to 'ContentElementController::close'
File
- src/
Controller/ ContentElementController.php, line 30
Class
- ContentElementController
- Provides route responses for content_sync element.
Namespace
Drupal\content_sync\ControllerCode
public function close($storage, $id) {
if (!in_array($storage, [
'user',
'state',
])) {
throw new \Exception('Undefined storage mechanism for Content Sync close message.');
}
ContentSyncMessage::setClosed($storage, $id);
return new AjaxResponse();
}