function forum_CrumbsMonoPlugin_forumThreadCreateTitle::findTitle in Crumbs, the Breadcrumbs suite 7.2
Set a breadcrumb item title for e.g. node/add/(type)/(tid), where
- (type) a forum-enabled node type, e.g. "forum".
- (tid) is the forum term tid.
Overrides crumbs_MonoPlugin_FindTitleInterface::findTitle
File
- plugins/
crumbs.forum.inc, line 197
Class
Code
function findTitle($path, $item) {
if (substr($path, 0, 9) === 'node/add/' && preg_match('#^node/add/([^/]+)/(\\d+)$#', $path, $m)) {
$type = $m[1];
$tid = (int) $m[2];
// We need to find out if the node type is forum-enabled.
// See _forum_node_check_node_type() in forum.module.
$field = field_info_instance('node', 'taxonomy_forums', $type);
if (is_array($field)) {
// That's a node/add/(type)/(tid) page for a forum-enabled node type.
$term = taxonomy_term_load($item['original_map'][3]);
if ($term instanceof stdClass && 'forums' === $term->vocabulary_machine_name) {
return $this
->newTopicTitle($type);
}
}
}
return NULL;
}