function single_page_site_next_page_get_single_page_items in Single Page Site 7
Fetches single page items.
Return value
type
1 call to single_page_site_next_page_get_single_page_items()
- single_page_site_next_page_single_page_site_output_alter in modules/
single_page_site_next_page/ single_page_site_next_page.module - Implements hook_single_page_site_alter_output().
File
- modules/
single_page_site_next_page/ single_page_site_next_page.module, line 31
Code
function single_page_site_next_page_get_single_page_items() {
$settings = variable_get('single_page_site_settings', array());
$items = array();
$menu_name = $settings['menu'];
$tree = menu_tree($menu_name);
foreach ($tree as $key => $item) {
// Check if menu item has to be rendered.
$render_menu_item = FALSE;
if (is_numeric($key)) {
if ($item['#href'] != '<front>') {
if (empty($settings['class'])) {
// If class is empty => all menu items.
$render_menu_item = TRUE;
}
elseif (!empty($item['#title']) && !empty($item['#localized_options']['attributes']['class']) && in_array($settings['class'], $item['#localized_options']['attributes']['class'])) {
// If class is filled out => Only menu items with class.
$render_menu_item = TRUE;
}
}
}
if ($render_menu_item) {
$items[] = $item;
}
}
return $items;
}