Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / node_access_records_alter.twig
1 /**
2  * Implements hook_node_access_records_alter().
3  */
4 function {{ machine_name }}_node_access_records_alter(&$grants, $node) {
5   // Our module allows editors to mark specific articles with the 'is_preview'
6   // field. If the node being saved has a TRUE value for that field, then only
7   // our grants are retained, and other grants are removed. Doing so ensures
8   // that our rules are enforced no matter what priority other grants are given.
9   if ($node->is_preview) {
10     // Our module grants are set in $grants['example'].
11     $temp = $grants['example'];
12     // Now remove all module grants but our own.
13     $grants = array('example' => $temp);
14   }
15 }