Example #1
0
 /**
  * Action for removing a user backend
  */
 public function removeuserbackendAction()
 {
     $this->assertPermission('config/application/userbackend');
     $form = new ConfirmRemovalForm(array('onSuccess' => function ($form) {
         $configForm = new UserBackendConfigForm();
         $configForm->setIniConfig(Config::app('authentication'));
         $authBackend = $form->getRequest()->getQuery('backend');
         try {
             $configForm->remove($authBackend);
         } catch (InvalidArgumentException $e) {
             Notification::error($e->getMessage());
             return false;
         }
         if ($configForm->save()) {
             Notification::success(sprintf(t('User backend "%s" has been successfully removed'), $authBackend));
         } else {
             return false;
         }
     }));
     $form->setTitle($this->translate('Remove User Backend'));
     $form->setRedirectUrl('config/userbackend');
     $form->setAction(Url::fromRequest());
     $form->handleRequest();
     $this->view->form = $form;
     $this->render('userbackend/remove');
 }