function _menu_link_node_menu_instance in Menu Link (Field) 7
Builds an instance of the default menu link field based on a content type's menu settings.
Parameters
$info object: The content type object.
Return value
array An associative array representing an instance structure.
1 call to _menu_link_node_menu_instance()
- _menu_link_node_menu_update_field in menu_link_node_menu/
menu_link_node_menu.module - Adds, updates or deletes the default menu link field from a content type based on its menu settings.
File
- menu_link_node_menu/
menu_link_node_menu.module, line 152 - Use a menu link field for core.
Code
function _menu_link_node_menu_instance($info) {
$menu_options = variable_get('menu_options_' . $info->type, array(
'main-menu',
));
$default = variable_get('menu_parent_' . $info->type, 'main-menu:0');
list($default_menu_name, $default_plid) = explode(':', $default);
return array(
'field_name' => MENU_LINK_DEFAULT_FIELD,
'entity_type' => 'node',
'bundle' => $info->type,
'label' => t('Menu'),
'settings' => array(
'menu_options' => $menu_options,
),
'default_value' => array(
0 => array(
'mlid' => NULL,
'menu_name' => $default_menu_name,
'plid' => $default_plid,
),
),
);
}