You are here

private function MenuLinkNodeMenu::loadMenu in Menu Link (Field) 7

4 calls to MenuLinkNodeMenu::loadMenu()
MenuLinkNodeMenu::offsetExists in menu_link_node_menu/menu_link_node_menu.module
MenuLinkNodeMenu::offsetGet in menu_link_node_menu/menu_link_node_menu.module
MenuLinkNodeMenu::offsetSet in menu_link_node_menu/menu_link_node_menu.module
MenuLinkNodeMenu::offsetUnset in menu_link_node_menu/menu_link_node_menu.module

File

menu_link_node_menu/menu_link_node_menu.module, line 41
Use a menu link field for core.

Class

MenuLinkNodeMenu

Code

private function loadMenu() {
  $item = array();

  // Prepare the node for the edit form so that $node->menu always exists.
  $menu_name = strtok(variable_get('menu_parent_' . $this->node->type, 'main-menu:0'), ':');
  if (!empty($this->node->{MENU_LINK_DEFAULT_FIELD}[LANGUAGE_NONE][0]['mlid'])) {
    $mlid = $this->node->{MENU_LINK_DEFAULT_FIELD}[LANGUAGE_NONE][0]['mlid'];
    $item = menu_link_load($mlid);
  }

  // Set default values.
  $this->menu = $item + array(
    'link_title' => '',
    'mlid' => 0,
    'plid' => 0,
    'menu_name' => $menu_name,
    'weight' => 0,
    'options' => array(),
    'module' => 'menu',
    'expanded' => 0,
    'hidden' => 0,
    'has_children' => 0,
    'customized' => 0,
  );
}