本文整理匯總了PHP中Term::object_types方法的典型用法代碼示例。如果您正苦於以下問題:PHP Term::object_types方法的具體用法?PHP Term::object_types怎麽用?PHP Term::object_types使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Term
的用法示例。
在下文中一共展示了Term::object_types方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render_menu_item
/**
* Callback function for block output of menu list item
**/
public function render_menu_item(Term $term, $config)
{
$title = $term->term_display;
$active = false;
$menu_type_data = $this->get_menu_type_data();
$spacer = false;
$active = false;
$link = null;
if (!isset($term->object_id)) {
$objects = $term->object_types();
$term->type = reset($objects);
$term->object_id = key($objects);
}
if (isset($menu_type_data[$term->type]['render'])) {
$result = $menu_type_data[$term->type]['render']($term, $term->object_id, $config);
$result = array_intersect_key($result, array('link' => 1, 'title' => 1, 'active' => 1, 'spacer' => 1, 'config' => 1));
extract($result);
}
if (empty($link)) {
$config['wrapper'] = sprintf($config['linkwrapper'], $title);
} else {
$config['wrapper'] = sprintf($config['linkwrapper'], "<a href=\"{$link}\">{$title}</a>");
}
if ($active) {
$config['itemattr']['class'] = 'active';
} else {
$config['itemattr']['class'] = 'inactive';
}
if ($spacer) {
$config['itemattr']['class'] .= ' spacer';
}
return $config;
}