You are here

function private_node_view in Private 7

Same name and namespace in other branches
  1. 7.2 private.module \private_node_view()

Implements hook_node_view().

File

./private.module, line 258
A tremendously simple access control module -- it allows users to mark individual nodes as private; users with 'access private content' perms can read these nodes, while others cannot.

Code

function private_node_view($node, $view_mode) {
  if (isset($node->private) && $node->private == 1) {
    $links['private_icon']['title'] = theme('private_node_link');
    $links['private_icon']['html'] = TRUE;
    $node->content['links']['private'] = array(
      '#theme' => 'links__node__private',
      '#links' => $links,
      '#attributes' => array(
        'class' => array(
          'links',
          'inline',
        ),
      ),
    );
  }
}