You are here

function content_access_per_node_setting in Content Access 8

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

Access per node setting.

Returns the per node role settings. If no per node settings are available, it will return the content type settings.

Parameters

string $op: One of the supported operations.

\Drupal\node\NodeInterface $node: The node object.

array $settings: Optional array used to update the settings cache with the given settings.

Return value

array An array of role ids which have access.

7 calls to content_access_per_node_setting()
ActionGrantNodePermissions::execute in src/Plugin/RulesAction/ActionGrantNodePermissions.php
Executes the plugin.
ActionRevokeNodePermissions::execute in src/Plugin/RulesAction/ActionRevokeNodePermissions.php
Executes the plugin.
ContentAccessPageForm::buildForm in src/Form/ContentAccessPageForm.php
Form constructor.
content_access_delete_per_node_settings in ./content_access.module
Delete per node settings.
content_access_get_rids_per_node_op in ./content_access.module
Get rids per node.

... See full list

File

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

Code

function content_access_per_node_setting($op, NodeInterface $node, array $settings = NULL) {
  static $grants = [];
  if (isset($settings)) {

    // Update settings cache.
    $grants[$node
      ->id()] = $settings;
    return $settings;
  }
  if (!isset($grants[$node
    ->id()]) || $grants[$node
    ->id()] === FALSE) {
    $grants[$node
      ->id()] = content_access_get_per_node_settings($node);
  }

  // Return the content type defaults if no per node settings are available.
  return isset($grants[$node
    ->id()][$op]) ? $grants[$node
    ->id()][$op] : content_access_get_settings($op, $node
    ->getType());
}