function linkit_taxonomy_linkit_get_search_styled_link in Linkit 7
Same name and namespace in other branches
- 6 plugins/linkit_taxonomy/linkit_taxonomy.module \linkit_taxonomy_linkit_get_search_styled_link()
Implements hook_linkit_get_search_styled_link().
File
- plugins/
linkit_taxonomy/ linkit_taxonomy.module, line 60 - Extend Linkit with taxonomy links.
Code
function linkit_taxonomy_linkit_get_search_styled_link($string) {
// Check to see that the link really is a term link
// Backwards compatible with internal: links
$escaped_string = str_replace('internal:', '', $string);
$splitted_string = explode('/', $escaped_string);
if ($splitted_string[0] != 'taxonomy' && $splitted_string[0] != 'forum') {
return;
}
// This is a term link created with Linkit, try to grab the title and path now.
$result = db_select('taxonomy_term_data', 't')
->fields('t', array(
'name',
))
->condition('t.tid', $splitted_string[count($splitted_string) - 1])
->addTag('term_access')
->execute()
->fetchObject();
// No reault was found
if (!$result) {
return;
}
return check_plain($result->name) . ' [path:' . $escaped_string . ']';
}