You are here

function menu_patterns_export_all_menu_item in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns_components/components/menu.inc \menu_patterns_export_all_menu_item()
1 string reference to 'menu_patterns_export_all_menu_item'
menu_patterns in patterns_components/components/menu.inc

File

patterns_components/components/menu.inc, line 59

Code

function menu_patterns_export_all_menu_item($args = NULL, &$result = NULL) {

  //$info = menu_patterns($data=NULL);

  //$form_id = current($info['menu_item'][PATTERNS_MODIFY]);

  //$menu_items = db_query("SELECT * FROM {menu_links} ORDER BY link_title", array(), array('fetch' => PDO::FETCH_ASSOC));
  $menus = menu_get_active_menu_names();
  $menu_items = menu_load_links($menus);
  $result = array();
  $i = 0;
  foreach ($menu_items as $menu_item) {
    $i++;
    $menu_item = (array) $menu_item;
    if ($menu_item['link_title'] == '') {
      $menu_item['link_title'] = 'null';
    }

    //$menu_item['options'] = unserialize($menu_item['options']);
    $menu_item['href'] = "";
    $data = array(
      'tag' => 'menu_item',
    );

    //print $data;
    $data = array_merge($data, $menu_item);
    $action = array(
      PATTERNS_CREATE => $data,
    );
    array_push($result, $action);

    // It is important to user array merge. Pushing is not enough

    //$result = array_merge($result, patterns_export_actions_from_form($form_id, $menu_item, 'menu_item', PATTERNS_MODIFY));
  }
  return $result;
}