You are here

function features_menu_link_load_by_mlid in Features 7.2

Loads a raw menu link by mlid.

Unlike core's menu_link_load(), this does not add any data from menu_router, and it does not call _menu_link_translate(). All it does is to unserialize the 'options' array.

Parameters

int|string $mlid: The menu link id, either as an integer or as a string representation of an integer.

Return value

array|false A record from 'menu_links' table, or FALSE if not found. The 'options' array will be unserialized.

See also

features_menu_link_load()

menu_link_load()

2 calls to features_menu_link_load_by_mlid()
menu_links_features_export_options in includes/features.menu.inc
Implements hook_features_export_options().
menu_links_features_export_render in includes/features.menu.inc
Implements hook_features_export_render().

File

includes/features.menu.inc, line 538
Features integration for 'menu' module.

Code

function features_menu_link_load_by_mlid($mlid) {
  $q = db_select('menu_links');
  $q
    ->fields('menu_links', array(
    'menu_name',
    'mlid',
    'plid',
    'link_path',
    'router_path',
    'link_title',
    'options',
    'module',
    'hidden',
    'external',
    'has_children',
    'expanded',
    'weight',
    'customized',
  ));
  $q
    ->condition('mlid', $mlid);
  if (!($qr = $q
    ->execute())) {

    // The query is broken or failing.
    // This is not expected to happen.
    return FALSE;
  }
  if (!($link = $qr
    ->fetchAssoc())) {

    // Menu link not found.
    return FALSE;
  }
  $link['options'] = unserialize($link['options']);
  return $link;
}