You are here

function om_menu_classes in OM Tools 8.2

Same name and namespace in other branches
  1. 6.2 tools/menu/menu.inc \om_menu_classes()
  2. 7.2 tools/menu/menu.inc \om_menu_classes()

Menu Classes Form

1 call to om_menu_classes()
om_menu_tools in tools/menu/menu.inc
Menu Tools Form

File

tools/menu/menu.inc, line 94
Menu Tools

Code

function om_menu_classes($menu_defaults = array()) {

  // Menu Classes
  $out = array();

  // get new menus
  $menu_defaults = om_menu_classes_get($menu_defaults, FALSE);

  // reset menu classes
  if (isset($block_classes['menu_classes_reset']) && $block_classes['menu_classes_reset'] == 1) {
    $menu_defaults['menu_classes_reset'] = 0;
    $menu_defaults = om_menu_classes_get($menu_defaults, TRUE);
  }
  $out['menu_classes_switch'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add custom menu classes'),
    '#default_value' => isset($menu_defaults['menu_classes_switch']) ? $menu_defaults['menu_classes_switch'] : 0,
  );
  $out['menu_classes_settings'] = array(
    '#type' => 'fieldset',
    '#attributes' => array(
      'id' => 'om-group-menu-classes-settings',
    ),
    '#title' => t('Menu Classes Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('This feature only works using <a href="@link">OM Base Theme 2</a>', array(
      '@link' => 'http://drupal.org/project/om',
    )),
  );
  $excluded = array(
    'menu_classes_switch',
    'menu_classes_reset',
  );
  foreach ($menu_defaults as $menu_group => $links) {
    if (!in_array($menu_group, $excluded)) {
      $out['menu_classes_settings'][$menu_group] = array(
        '#type' => 'fieldset',
        '#title' => t(ucwords($menu_group)),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      foreach ($links as $link_title => $prop) {
        $out['menu_classes_settings'][$menu_group]['menu_classes_' . $prop['mlid']] = array(
          '#type' => 'textfield',
          '#title' => t('Title: ' . $prop['link_title'] . ' <a href="' . base_path() . 'admin/structure/menu/item/' . $prop['mlid'] . '/edit' . '?destination=admin/config/system/om-tools">Edit</a>'),
          '#default_value' => $prop['menu_classes_' . $prop['mlid']],
        );
      }
    }
  }
  $out['menu_classes_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reset to default values.'),
    '#default_value' => isset($menu_defaults['menu_classes_reset']) ? $menu_defaults['menu_classes_reset'] : 0,
  );
  return $out;
}