You are here

function _accountmenu_setup_menu in Account menu 6

Same name and namespace in other branches
  1. 7 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 78
accountmenu.module Provide a dynamic Log in/My account/Log out account menu

Code

function _accountmenu_setup_menu() {
  $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' => variable_get('accountmenu_menu_name', 'accountmenu'),
    'module' => 'accountmenu',
  );
  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' => variable_get('accountmenu_menu_name', 'accountmenu'),
    'module' => 'accountmenu',
  );
  menu_link_save($item);
  $item = array(
    'link_title' => 'My account',
    'link_path' => 'user/%',
    'title_callback' => NULL,
    'title_arguments' => NULL,
    'options' => array(
      'alter' => TRUE,
      'attributes' => array(
        'title' => t('View/edit user account.'),
      ),
    ),
    'weight' => 0,
    'menu_name' => variable_get('accountmenu_menu_name', 'accountmenu'),
    'module' => 'accountmenu',
  );
  menu_link_save($item);
  $item = array(
    'link_title' => 'Logout',
    'link_path' => 'logout',
    'weight' => 1,
    'menu_name' => variable_get('accountmenu_menu_name', 'accountmenu'),
    'module' => 'accountmenu',
  );
  menu_link_save($item);
}