You are here

function protected_node_protected_node_hide in Protected Node 7

Same name and namespace in other branches
  1. 6 protected_node.module \protected_node_protected_node_hide()
  2. 1.0.x protected_node.module \protected_node_protected_node_hide()

Implements hook_protected_node_hide().

We implement this callback since it makes sense (I think) although it makes the module a bit slower.

This function hides the body, and if requested on that node we hide the title as well.

@param[in,out] $node The affected node.

File

./protected_node.module, line 764
Protected Node module.

Code

function protected_node_protected_node_hide(&$node) {

  // Core module fields.
  if (!$node->protected_node_show_title) {
    $node->title = t('Password protected page');
  }
  $node->body = '';

  // Remove $node->content children to avoid the user see content he/she should
  // not see.
  $content_children = element_children($node->content);
  foreach ($content_children as $content_key) {
    unset($node->content[$content_key]);
  }
}