function _devel_node_access_get_node_title

Same name 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.

1 call to _devel_node_access_get_node_title()
devel_node_access_block in ./devel_node_access.module

File

./devel_node_access.module, line 777

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;';
}