RebuildPermissionsForm.php

Same filename in other branches
  1. 9 core/modules/node/src/Form/RebuildPermissionsForm.php
  2. 8.9.x core/modules/node/src/Form/RebuildPermissionsForm.php
  3. 11.x core/modules/node/src/Form/RebuildPermissionsForm.php

Namespace

Drupal\node\Form

File

core/modules/node/src/Form/RebuildPermissionsForm.php

View source
<?php

namespace Drupal\node\Form;

use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * Form for rebuilding permissions.
 *
 * @internal
 */
class RebuildPermissionsForm extends ConfirmFormBase {
    
    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return 'node_configure_rebuild_confirm';
    }
    
    /**
     * {@inheritdoc}
     */
    public function getQuestion() {
        return $this->t('Are you sure you want to rebuild the permissions on site content?');
    }
    
    /**
     * {@inheritdoc}
     */
    public function getCancelUrl() {
        return new Url('system.status');
    }
    
    /**
     * {@inheritdoc}
     */
    public function getConfirmText() {
        return $this->t('Rebuild permissions');
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDescription() {
        return $this->t('This action rebuilds all permissions on site content, and may be a lengthy process. This action cannot be undone.');
    }
    
    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
        node_access_rebuild(TRUE);
        $form_state->setRedirectUrl($this->getCancelUrl());
    }

}

Classes

Title Deprecated Summary
RebuildPermissionsForm Form for rebuilding permissions.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.