You are here

function rotor_admin_form in Rotor Banner 5

Same name and namespace in other branches
  1. 5.7 rotor.module \rotor_admin_form()
  2. 6 rotor.module \rotor_admin_form()

Admin settings form page.

2 string references to 'rotor_admin_form'
rotor_admin_form_submit in ./rotor.module
Admin settings form submit function
rotor_menu in ./rotor.module
Implementation of hook_menu().

File

./rotor.module, line 103
A rotor banner consists in a set of images that will be changing. This module is made using jquery.

Code

function rotor_admin_form() {
  $form['basic_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Basics'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['basic_settings']['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => variable_get('rotor_height', 200),
    '#rows' => 1,
    '#size' => 4,
    '#description' => t('The Rotor item height, in pixels.'),
  );
  $form['basic_settings']['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => variable_get('rotor_width', 200),
    '#rows' => 1,
    '#size' => 4,
    '#description' => t('The Rotor item width, in pixels.'),
  );
  $form['basic_settings']['max_items'] = array(
    '#type' => 'textfield',
    '#title' => t('Max nodes'),
    '#default_value' => variable_get('rotor_max_items', 3),
    '#rows' => 1,
    '#size' => 2,
    '#description' => t('Define the maximun number of nodes to present in the rotor block.'),
  );
  $form['basic_settings']['random_items'] = array(
    '#type' => 'checkbox',
    '#title' => t('Randomize nodes'),
    '#default_value' => variable_get('rotor_random_items', 0),
    '#description' => t('Enables/Disables random selection of nodes that will be present in the rotor block.'),
  );
  if (module_exists('nodequeue')) {
    $queues = nodequeue_load_queues(nodequeue_get_all_qids());
    $queue_list[0] = t('None');
    foreach ($queues as $qid => $queue) {
      $queue_list[$qid] = $queue->title;
    }
    $form['queue_group'] = array(
      '#type' => 'fieldset',
      '#title' => t('Node Queue Settings'),
      '#description' => t("If you select a queue the Rotor item 'basic' settings will be ignored. " . 'To administrate the queue please go <a href="@nodequeue_url">here</a>', array(
        '@nodequeue_url' => url('admin/content/nodequeue'),
      )),
      '#weight' => -2,
    );
    $form['queue_group']['nodequeue'] = array(
      '#type' => 'select',
      '#title' => t('Node Queue'),
      '#default_value' => variable_get('rotor_nodequeue', 0),
      '#options' => $queue_list,
      '#description' => t('Use node a nodequeue instead of Rotor items'),
    );
  }
  $form['animation_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Animation'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['animation_settings']['time'] = array(
    '#type' => 'textfield',
    '#title' => t('Time'),
    '#default_value' => variable_get('rotor_seconds', 10),
    '#rows' => 1,
    '#size' => 2,
    '#description' => t('The time in seconds that will be shown every Rotor item before change to the next one.'),
  );
  $form['animation_settings']['speed'] = array(
    '#type' => 'textfield',
    '#title' => t('Speed'),
    '#default_value' => variable_get('rotor_speed', 1),
    '#rows' => 1,
    '#size' => 2,
    '#description' => t('The time in seconds of the transition effect between each Rotor item (set to 0 for no transition).'),
  );
  $form['animation_settings']['effect'] = array(
    '#type' => 'select',
    '#title' => t('Effect'),
    '#default_value' => variable_get('rotor_effect', 'fade'),
    '#options' => _rotor_get_effects(),
    '#description' => t('The effect to use when changing to the next Rotor item.'),
  );
  $form['animation_settings']['pause'] = array(
    '#type' => 'checkbox',
    '#title' => t('Pause on hover'),
    '#default_value' => variable_get('rotor_pause', 0),
    '#description' => t('Enables/Disables pause on hover.'),
  );
  $form['tab_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Tabs'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['tab_settings']['show_tab'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable tabs'),
    '#default_value' => variable_get('rotor_show_tabs', 1),
    '#description' => t('Shows/Hide the item tabs in the block'),
  );
  $form['tab_settings']['group_tabs'] = array(
    '#type' => 'radios',
    '#title' => t('Group tabs'),
    '#default_value' => variable_get('rotor_group_tabs', ROTOR_GROUP_TABS),
    '#options' => array(
      ROTOR_GROUP_TABS => t('Group tabs'),
      ROTOR_DONT_GROUP_TABS => t("Each tab with its own item"),
    ),
    '#description' => t("If tabs are grouped, all Rotor item tabs will be displayed together (all at once). Clicking on a tab will take force the rotor to rotate to the tabs content. otherwise each tab will be displayed with its own content only and will not be clickable."),
  );
  $form['tab_settings']['tab_position'] = array(
    '#type' => 'select',
    '#title' => t('Tab position'),
    '#default_value' => variable_get('rotor_tab_position', ROTOR_TAB_POSITION_TOP),
    '#options' => array(
      ROTOR_TAB_POSITION_TOP => t("Above"),
      ROTOR_TAB_POSITION_BOTTOM => t("Below"),
    ),
    '#description' => t("Where the tabs should be positioned."),
  );
  if (module_exists('imagecache')) {
    $presets = rotor_get_imagecache_presets();
    $presets[0] = t('None');
    $form['imagecache'] = array(
      '#type' => 'select',
      '#title' => t('Imagecache preset'),
      '#default_value' => variable_get('rotor_imagecache_preset', 0),
      '#options' => $presets,
      '#description' => t('Select the imagecache preset to use for the images'),
    );
  }
  $form['#suffix'] = theme('rotor_admin_list', rotor_get_items());
  return system_settings_form($form);
}