You are here

function content_access_per_node_setting in Content Access 5

Same name and namespace in other branches
  1. 8 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()
4 calls to content_access_per_node_setting()
content_access_condition_check_permissions in ./content_access.workflow_ng.inc
Condition implementation: Check if node has permissions.
content_access_node_access_records in ./content_access.module
content_access_page in ./content_access.module
content_access_save_per_node_settings in ./content_access.module

File

./content_access.module, line 515

Code

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

    //update settings cache
    $grants[$node->nid] = $settings;
    return;
  }
  if (!isset($grants[$node->nid])) {

    //load settings from db
    $grants[$node->nid] = content_access_get_per_node_settings($node);
  }

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