function _devel_node_access_get_node_title

Return a sanitized node title.

Parameters

$node: The node from which to get the title.

boolean $clip_and_decorate: (optional) Set to TRUE to limit the length of the returned title and to add markup to make it easier to style.

Return value

string The sanitized node title.

1 call to _devel_node_access_get_node_title()
devel_node_access_block_view in ./devel_node_access.module
Implements hook_block_view().

File

./devel_node_access.module, line 1387

Code

function _devel_node_access_get_node_title($node, $clip_and_decorate = FALSE) {
    if (isset($node)) {
        if (isset($node->title)) {
            $node_title = check_plain(!is_array($node->title) ? $node->title : $node->title[LANGUAGE_NONE][0]['value']);
            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;';
}