You are here

function power_menu_admin_form in Power Menu 7

Same name and namespace in other branches
  1. 6 power_menu.admin.inc \power_menu_admin_form()

Callback function for the admin form

1 string reference to 'power_menu_admin_form'
power_menu_menu in ./power_menu.module
Implements hook_menu().

File

./power_menu.admin.inc, line 11
This contains all the admin stuff of the module

Code

function power_menu_admin_form($form, &$form_state) {
  global $language;
  $menus = menu_get_menus();
  $form['power_menu_menu'] = array(
    '#type' => 'checkboxes',
    '#options' => $menus,
    '#title' => t('Power Menu'),
    '#default_value' => variable_get('power_menu_menu', array()),
    '#description' => t('Choose the menu which should be your power menu. You can choose multiple menus. Main usecase for selecting multiple menus
    would be if you have a site with multiple languages. IMPORTANT: At the same time only one menu should be present!'),
  );
  $form['power_menu_breadcrumb_title'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display title in breadcrumbs'),
    '#default_value' => variable_get('power_menu_breadcrumb_title', FALSE),
  );
  $node_types = array();
  foreach (node_type_get_types() as $key => $value) {
    $node_types[$key] = $value->name;
  }
  $form['power_menu_path_content_types'] = array(
    '#type' => 'checkboxes',
    '#options' => $node_types,
    '#title' => t('Content type for path recognition'),
    '#default_value' => variable_get('power_menu_path_content_types', array()),
    '#description' => t('Choose the content types for which the path alias should define the menu trail. The parent path element is used to find a menu link with the given path. Example: Path for content \'forum/discussion/myquestion\', lookup for a menu link \'forum/discussion\' ant activate tis menu.'),
  );
  if (module_exists('taxonomy')) {
    $ar_vocabs = array();
    $vocabs = taxonomy_get_vocabularies();
    foreach ($vocabs as $vocab) {
      $ar_vocabs[$vocab->vid] = $vocab->name;
    }
    $form['power_menu_taxonomy_navigation'] = array(
      '#type' => 'select',
      '#options' => $ar_vocabs,
      '#title' => t('Navigation Taxonomy'),
      '#default_value' => variable_get('power_menu_taxonomy_navigation', ''),
      '#description' => t('Choose the taxonomy which is going to reflect the structure of your menu. It gives you the option to create taxonomy terms from your menu.'),
    );
    $form['power_menu_taxonomy_field'] = array(
      '#type' => 'textfield',
      '#title' => t('Navigation taxonomy field name'),
      '#default_value' => variable_get('power_menu_taxonomy_field', ''),
      '#description' => t('Set the taxonomy field name (set in entities) which is used for going to reflect the structure of your menu. It is important, that every entity use the same field name!'),
      '#field_prefix' => 'field_',
    );
  }
  else {
    drupal_set_message(t("You don't have the taxonomy module enabled. There is nothing to configure."));
  }
  return system_settings_form($form);
}