You are here

function content_access_delete_per_node_settings in Content Access 8

Same name and namespace in other branches
  1. 6 content_access.module \content_access_delete_per_node_settings()
  2. 7 content_access.module \content_access_delete_per_node_settings()

Delete per node settings.

Deletes all custom per node settings, so that content type defaults are used again.

2 calls to content_access_delete_per_node_settings()
ActionResetNodePermissions::execute in src/Plugin/RulesAction/ActionResetNodePermissions.php
Executes the plugin.
ContentAccessPageForm::pageResetSubmit in src/Form/ContentAccessPageForm.php
Submit callback for reset on content_access_page().

File

./content_access.module, line 546
Content access module file.

Code

function content_access_delete_per_node_settings(NodeInterface $node) {
  \Drupal::database()
    ->delete('content_access')
    ->condition('nid', $node
    ->id())
    ->execute();

  // Clear the cache.
  content_access_per_node_setting(NULL, $node);

  // Delete possible acl settings.
  if (\Drupal::moduleHandler()
    ->moduleExists('acl')) {
    module_load_include('inc', 'content_access', 'content_access.admin');
    foreach ([
      'view',
      'update',
      'delete',
    ] as $op) {
      $acl_id = content_access_get_acl_id($node, $op);
      acl_delete_acl($acl_id);
    }
  }
}