Version 1
[yaffs-website] / web / core / modules / node / src / Form / RebuildPermissionsForm.php
1 <?php
2
3 namespace Drupal\node\Form;
4
5 use Drupal\Core\Form\ConfirmFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7 use Drupal\Core\Url;
8
9 class RebuildPermissionsForm extends ConfirmFormBase {
10
11   /**
12    * {@inheritdoc}
13    */
14   public function getFormId() {
15     return 'node_configure_rebuild_confirm';
16   }
17
18   /**
19    * {@inheritdoc}
20    */
21   public function getQuestion() {
22     return t('Are you sure you want to rebuild the permissions on site content?');
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   public function getCancelUrl() {
29     return new Url('system.status');
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   public function getConfirmText() {
36     return t('Rebuild permissions');
37   }
38
39   /**
40    * {@inheritdoc}
41    */
42   public function getDescription() {
43     return t('This action rebuilds all permissions on site content, and may be a lengthy process. This action cannot be undone.');
44   }
45
46   /**
47    * {@inheritdoc}
48    */
49   public function submitForm(array &$form, FormStateInterface $form_state) {
50     node_access_rebuild(TRUE);
51     $form_state->setRedirectUrl($this->getCancelUrl());
52   }
53
54 }