You are here

function menu_icons_admin_settings in Menu Icons 8

Same name and namespace in other branches
  1. 6.2 menu_icons.module \menu_icons_admin_settings()
  2. 6 menu_icons.module \menu_icons_admin_settings()
  3. 7.3 menu_icons.module \menu_icons_admin_settings()

Build the menu_icon's settings form

Return value

a form array

2 string references to 'menu_icons_admin_settings'
menu_icons_form_alter in ./menu_icons.module
Implementation of hook_form_alter().
menu_icons_menu in ./menu_icons.module
Implementation of hook_menu().

File

./menu_icons.module, line 164
Module to associate icons with menu items

Code

function menu_icons_admin_settings() {
  $form['menu_icons_default_icon'] = array(
    '#type' => 'textfield',
    '#title' => t('Icon path'),
    '#default_value' => variable_get('menu_icons_default_icon', drupal_get_path('module', 'menu_icons') . '/images/default_icon.png'),
    '#description' => t('A Drupal path to the icon or image to use as a default.'),
    '#required' => FALSE,
  );
  if (module_exists('imagecache')) {
    $options = array();
    foreach (imagecache_presets() as $pid => $preset) {
      $options[$preset['presetname']] = $preset['presetname'];
    }
    if (!empty($options)) {
      $form['menu_icons_imagecache_default'] = array(
        '#type' => 'select',
        '#title' => t('Imagecache default preset'),
        '#default_value' => variable_get('menu_icons_imagecache_default', 'menu_icon'),
        '#description' => t('Choose a default !link to be used for menu icons. This setting can be overwritten per menu item.', array(
          '!link' => l(t('Imagecache preset'), 'admin/build/imagecache'),
        )),
        '#required' => FALSE,
        '#options' => $options,
      );
    }
  }
  else {
    $form['menu_icons_file_validate_image_resolution'] = array(
      '#type' => 'textfield',
      '#title' => t('Max image resolution'),
      '#default_value' => variable_get('menu_icons_file_validate_image_resolution', '45x45'),
      '#description' => t('The maximum image resolution for the menu-icons. If an uploaded image exceeds this size, the image is resized automatically.'),
      '#required' => FALSE,
    );
  }
  $form['menu_icons_image_folder'] = array(
    '#type' => 'textfield',
    '#title' => t('Icon folder'),
    '#default_value' => variable_get('menu_icons_image_folder', 'menu_icons'),
    '#description' => t('The name of the files directory in which the new uploaded icons will be stored. This folder will be created in the files directory'),
    '#required' => FALSE,
  );
  $form['menu_icons_position'] = array(
    '#type' => 'select',
    '#title' => t('Position'),
    '#default_value' => variable_get('menu_icons_position', 'left'),
    '#options' => array(
      'right' => t('right'),
      'left' => t('left'),
    ),
    '#required' => FALSE,
  );
  return system_settings_form($form);
}