You are here

function _menu_select_autocomplete in Menu Select 7

Menu Select autocomplete config page.

See also

menu_select_menu().

1 string reference to '_menu_select_autocomplete'
menu_select_menu in ./menu_select.module
Implements hook_menu().

File

./menu_select.module, line 271
Expands the node menu select field functionality by adding filters and an expandable hierarchy.

Code

function _menu_select_autocomplete($type = '', $partial = '') {
  $matches = array();
  $partial = strtolower($partial);
  $options = menu_parent_options(menu_get_menus(), $type, $type);
  foreach ($options as $mkey => $option) {
    if (strpos(strtolower($option), $partial) !== FALSE) {
      $option = preg_replace('/^\\-+\\s/', '', $option);
      $option = str_replace(array(
        '<',
        '>',
      ), '', $option);
      $matches[$mkey] = $option . ' (' . $mkey . ')';
    }
  }
  drupal_json_output($matches);
}