public function RestUIController::disable in REST UI 8
Disables a resource.
Parameters
string $resource_id: The identifier or the REST resource.
Return value
\Drupal\Core\Ajax\AjaxResponse|\Symfony\Component\HttpFoundation\RedirectResponse Redirects back to the listing page.
Throws
\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException Access is denied, if the token is invalid or missing.
1 string reference to 'RestUIController::disable'
File
- src/
Controller/ RestUIController.php, line 286
Class
- RestUIController
- Controller routines for REST resources.
Namespace
Drupal\restui\ControllerCode
public function disable($resource_id) {
$resources = $this->resourceConfigStorage
->loadMultiple();
if ($resources[$this
->getResourceKey($resource_id)]) {
$resources[$this
->getResourceKey($resource_id)]
->disable()
->save();
$this->messenger
->addStatus($this
->t('The resource was disabled successfully.'));
}
// Redirect back to the page.
return new RedirectResponse($this->urlGenerator
->generate('restui.list', [], TRUE));
}