function _accountmenu_setup_menu in Account menu 7
Same name and namespace in other branches
- 6 accountmenu.module \_accountmenu_setup_menu()
Create the menu links managed by accountmenu.
2 calls to _accountmenu_setup_menu()
- accountmenu_install in ./
accountmenu.install - Implements hook_install.
- _accountmenu_reset_menu in ./
accountmenu.module - Delete our links before making them again. we are really doing a move but there is no move api call so we delete first and re-create. !!! any menu customization made through the menu module UI are lost.
File
- ./
accountmenu.module, line 112 - accountmenu.module Provide a dynamic Log in/My account/Log out account menu
Code
function _accountmenu_setup_menu() {
$menu_name = variable_get('accountmenu_menu_name', 'accountmenu');
$item = array(
'link_title' => 'Login',
'link_path' => 'user/login',
'options' => array(
'alter' => TRUE,
'attributes' => array(
'title' => t('Login to the site.'),
'class' => 'popups-form-reload',
),
),
'weight' => 0,
'menu_name' => $menu_name,
'module' => 'accountmenu',
'languange' => 'en',
'customized' => 1,
);
menu_link_save($item);
$item = array(
'link_title' => 'Register',
'link_path' => 'user/register',
'hidden' => 1,
'options' => array(
'alter' => TRUE,
'attributes' => array(
'title' => t('Register a new account'),
'class' => 'popups-form-reload',
),
),
'weight' => 0,
'menu_name' => $menu_name,
'module' => 'accountmenu',
'languange' => 'en',
'customized' => 1,
);
menu_link_save($item);
$item = array(
'link_title' => 'My account',
'link_path' => 'user/self',
'title_callback' => NULL,
'title_arguments' => NULL,
'options' => array(
'alter' => TRUE,
'attributes' => array(
'title' => t('View/edit user account.'),
),
),
'weight' => 0,
'menu_name' => $menu_name,
'module' => 'accountmenu',
'languange' => 'en',
'customized' => 1,
);
menu_link_save($item);
$item = array(
'link_title' => 'Logout',
'link_path' => 'user/logout',
'weight' => 1,
'menu_name' => $menu_name,
'module' => 'accountmenu',
'languange' => 'en',
'customized' => 1,
);
menu_link_save($item);
// And clear the cache.
menu_cache_clear_all();
}