Same name and namespace in other branches
  1. 7.x-1.x devel_node_access.module \_devel_node_access_get_node_title()

Helper function to return a sanitized node title.

File

./devel_node_access.module, line 777
This module gives developers feedback as to what their node_access table contains, and which nodes are protected or visible to the public.

Code

function _devel_node_access_get_node_title($node, $clip_and_decorate = FALSE) {
  if (isset($node)) {
    if (isset($node->title)) {
      $node_title = check_plain($node->title);
      if ($clip_and_decorate) {
        if (drupal_strlen($node_title) > 20) {
          $node_title = "<span title='node/{$node->nid}: {$node_title}'>" . drupal_substr($node_title, 0, 15) . '...</span>';
        }
        $node_title = '<span title="node/' . $node->nid . '">' . $node_title . '</span>';
      }
      return $node_title;
    }
    elseif (isset($node->nid)) {
      return $node->nid;
    }
  }
  return '&mdash;';
}