You are here

public function ContentAccessPageForm::pageResetSubmit in Content Access 8

Submit callback for reset on content_access_page().

File

src/Form/ContentAccessPageForm.php, line 200

Class

ContentAccessPageForm
Node Access settings form.

Namespace

Drupal\content_access\Form

Code

public function pageResetSubmit(array &$form, FormStateInterface $form_state) {
  $storage = $form_state
    ->getStorage();
  content_access_delete_per_node_settings($storage['node']);
  $node = $storage['node'];
  $grants = $this->entityTypeManager
    ->getAccessControlHandler('node')
    ->acquireGrants($node);
  $this->grantStorage
    ->write($node, $grants);
  $this
    ->messenger()
    ->addMessage($this
    ->t('The permissions have been reset to the content type defaults.'));
}