function linkit_node_linkit_get_search_styled_link in Linkit 6
Same name and namespace in other branches
- 7 plugins/linkit_node/linkit_node.module \linkit_node_linkit_get_search_styled_link()
Implementation of hook_linkit_get_search_styled_link().
File
- plugins/
linkit_node/ linkit_node.module, line 115 - Extend Linkit with node links.
Code
function linkit_node_linkit_get_search_styled_link($string) {
// Node links created with Linkit will always begin with "internal:"
if (strpos($string, 'internal:') === FALSE) {
return;
}
// Check to see that the link really is a node link
$splitted_string = explode('/', str_replace('internal:', '', $string));
if ($splitted_string[0] != 'node') {
return;
}
// This is a node link created with Linkit, try to grab the title and path now.
$result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.nid = %d"), $splitted_string[1]);
$node = db_fetch_object($result);
// No reault or no node was found
if (!$result || !$node) {
return;
}
return check_plain($node->title) . ' [path:internal:node/' . $node->nid . ']';
}