You are here

function vsf_upload_admin_menu_output_build in Visual select file 7

Implements hook_admin_menu_output_build().

See also

amin_menu_admin_menu_output_build().

File

submodules/vsf_upload/vsf_upload.module, line 132

Code

function vsf_upload_admin_menu_output_build(&$content) {

  // Retrieve the "Add file" link tree.
  $link = db_query("SELECT * FROM {menu_links} WHERE router_path = 'file/add' AND module = 'system'")
    ->fetchAssoc();
  if ($link) {
    $conditions = array();
    for ($i = 1; $i < MENU_MAX_DEPTH; $i++) {
      if (!empty($link["p{$i}"])) {
        $conditions["p{$i}"] = $link["p{$i}"];
      }
    }
    $tree = menu_build_tree($link['menu_name'], array(
      'conditions' => $conditions,
      'min_depth' => $link['depth'],
    ));
    $links = admin_menu_links_menu($tree);
    if (!empty($links)) {

      // If the user has access to the top-level "Content" category, insert the
      // "Add file" link tree there.
      if (isset($content['menu']['admin/content'])) {
        $content['menu']['admin/content'] += $links;
      }
      else {
        $key = key($links);
        $links[$key]['#weight'] = -100;
        $content['menu'] += $links;
      }
    }
  }
}