/** * 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; }