diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-13 06:10:43 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-13 06:10:43 +0000 |
commit | b80bbba9af60c3b1be50901a26c1cf786e0cc6ef (patch) | |
tree | a420968ba4a2f2c559821c13ae28cb1f504929c7 /modules/node/node.api.php | |
parent | 87485fc3e4e8061b9a31c2bfd8b8caa8fcefa7c5 (diff) | |
download | brdo-b80bbba9af60c3b1be50901a26c1cf786e0cc6ef.tar.gz brdo-b80bbba9af60c3b1be50901a26c1cf786e0cc6ef.tar.bz2 |
#676134 by mcarbone: Update documentation to account for taxonomy changes (no more node taxonomy property).
Diffstat (limited to 'modules/node/node.api.php')
-rw-r--r-- | modules/node/node.api.php | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/modules/node/node.api.php b/modules/node/node.api.php index 4deb5c8c5..09dfe9d3c 100644 --- a/modules/node/node.api.php +++ b/modules/node/node.api.php @@ -132,32 +132,21 @@ function hook_node_access_records($node) { * The node for which the grants were acquired. * * The preferred use of this hook is in a module that bridges multiple node - * access modules with a configurable behavior, as shown in the example - * by the variable 'example_preview_terms'. This variable would - * be a configuration setting for your module. + * access modules with a configurable behavior, as shown in the example with the + * 'is_preview' field. * * @ingroup node_access */ function hook_node_access_records_alter(&$grants, $node) { - // Our module allows editors to tag specific articles as 'preview' - // content using the taxonomy system. If the node being saved - // contains one of the preview terms defined in our variable - // 'example_preview_terms', then only our grants are retained, - // and other grants are removed. Doing so ensures that our rules - // are enforced no matter what priority other grants are given. - $preview = variable_get('example_preview_terms', array()); - // Check to see if we have enabled complex behavior. - if (!empty($preview)) { - foreach ($preview as $term_id) { - if (isset($node->taxonomy[$term_id])) { - // Our module grants are set in $grants['example']. - $temp = $grants['example']; - // Now remove all module grants but our own. - $grants = array('example' => $temp); - // No need to check additonal terms. - break; - } - } + // Our module allows editors to mark specific articles with the 'is_preview' + // field. If the node being saved has a TRUE value for that field, then only + // our grants are retained, and other grants are removed. Doing so ensures + // that our rules are enforced no matter what priority other grants are given. + if ($node->is_preview) { + // Our module grants are set in $grants['example']. + $temp = $grants['example']; + // Now remove all module grants but our own. + $grants = array('example' => $temp); } } |