function path_breadcrumbs_entity_get_properties in Path Breadcrumbs 7.3
Entity API property 'pb_join' getter callback.
Support for %term:pb-join:name and %term:pb-join:url tokens.
3 string references to 'path_breadcrumbs_entity_get_properties'
- _path_breadcrumbs_menu_link_property_defaults in ./
path_breadcrumbs.info.inc - Return default 'menu-link' struct.
- _path_breadcrumbs_menu_trail_property_defaults in ./
path_breadcrumbs.info.inc - Return default 'path-menu-trail' structure.
- _path_breadcrumbs_pb_join_property_defaults in ./
path_breadcrumbs.info.inc - Return default 'pb-join' struct.
File
- ./
path_breadcrumbs.info.inc, line 33 - Contains Entity API hooks and callbacks.
Code
function path_breadcrumbs_entity_get_properties($data, array $options, $name, $type, $info) {
if (empty($data)) {
return;
}
if ($name == 'pb_join') {
$data->parent_type = $type;
return $data;
}
if (!empty($data->parent_type) && $data->parent_type == 'taxonomy_term') {
$result = array();
$parents = array_reverse(taxonomy_get_parents_all($data->tid));
foreach ($parents as $term) {
if ($name == 'name') {
$term_name = $term->name;
if (function_exists('i18n_taxonomy_term_name')) {
$term_name = i18n_taxonomy_term_name($term);
}
$result[] = $term_name;
}
elseif ($name == 'url') {
$result[] = 'taxonomy/term/' . $term->tid;
}
elseif ($name == 'none') {
$result[] = '<none>';
}
}
return implode("\n", $result);
}
return '';
}