It will be nice to have on the top, where are the buttons Home, Menu, etc., to have a search icon to expand the Drupal search. Because then we can search fast without to go to frontend or Dashboard.

Comments

caschbre’s picture

I think this would be a great addition!

scottrigby’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.x-dev
Status: Active » Closed (works as designed)

You can implement hook_navbar() in a custom module.

MY_MODULE_navbar() {
  $items = array();

  $form = drupal_get_form('search_form');
  $form['basic']['keys']['#title'] = NULL;
  $items['search'] = array(
    '#type' => 'navbar_item',
    'tab' => array(
      '#type' => 'markup',
      '#markup' => drupal_render($form),
    ),
    '#weight' => 101,
  );

  return $items;
}

Note you can set the weight of items you add in this hook (and if needed modify other items using hook_navbar_alter()). This example places the search bar higher than 'user', which has a weight of 100.

$form['basic']['keys']['#title'] = NULL; just removes the title from the search form render array. You can do whatever you wish to that before calling drupal_render().

caschbre’s picture

Ah, that's great news scottrigby!

heathdutton’s picture

Issue summary: View changes

Is there any work being done to have a "menu search" added?

I mean a way to search the menu for menu items. Administration Menu has had this (see thread: https://www.drupal.org/node/806350) and it has been extremely useful for large sites with hundreds of modules and dozens of content types. I got used to having this, and now find myself killing precious minutes hunting for menu items with this navbar.

It would be a very handy submodule. Has it been done?