You are here

function itoggle_form_admin in iToggle 7.2

Same name and namespace in other branches
  1. 7 includes/itoggle.admin.inc \itoggle_form_admin()

Form callback.

Return iToggle settings form.

See also

itoggle_menu().

1 string reference to 'itoggle_form_admin'
itoggle_menu in ./itoggle.module
Implements hook_menu().

File

./itoggle.admin.inc, line 14
iToggle settings.

Code

function itoggle_form_admin() {
  $form = array();
  $form['itoggle']['basic'] = array(
    '#type' => 'fieldset',
    '#title' => t('Basic Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['itoggle']['basic']['itoggle_compression_type'] = array(
    '#type' => 'radios',
    '#title' => t('Choose iToggle compression level'),
    '#options' => array(
      'min' => t('Production (Minified)'),
      'none' => t('Development (Uncompressed Code)'),
    ),
    '#default_value' => variable_get('itoggle_compression_type', 'min'),
  );
  $form['itoggle']['basic']['itoggle_css'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include Default CSS'),
    '#description' => t('Uncheck this if you want to include your own styles for iToggle.'),
    '#default_value' => variable_get('itoggle_css', TRUE),
  );
  $form['itoggle']['basic']['itoggle_speed'] = array(
    '#type' => 'textfield',
    '#size' => 4,
    '#title' => t('Animation Speed'),
    '#description' => t('iToggle animation speed, in milliseconds. Default is 200.'),
    '#default_value' => variable_get('itoggle_speed', 200),
  );
  $form['itoggle']['basic']['easing'] = array(
    '#type' => 'fieldset',
    '#title' => t('Easing'),
    '#description' => t('If you install the <a href="@easing_module">jQuery Easing</a> module you can specify an <a href="@easing_library">easing</a> function for iToggle here.', array(
      '@easing_module' => 'https://drupal.org/project/jqeasing',
      '@easing_library' => 'http://gsgd.co.uk/sandbox/jquery/easing',
    )),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );

  // Support the jquery.easing plugin via the jQuery Easing module.
  if (module_exists('jqeasing')) {
    $easing_options = _itoggle_jqeasing_options();

    // Sort easing methods.
    ksort($easing_options);
    $form['itoggle']['basic']['easing']['itoggle_easing_function'] = array(
      '#type' => 'select',
      '#title' => t('Easing Function'),
      '#empty_option' => ' -None- ',
      '#description' => t("Specify an easing callback here. iToggle default is 'easeOutExpo'."),
      '#default_value' => variable_get('itoggle_easing_function', ''),
      '#options' => $easing_options,
    );
  }
  $form['advanced'] = array(
    '#title' => t('Advanced Settings'),
    '#type' => 'fieldset',
    '#description' => '<p>' . t('For a full description of all iToggle callbacks, see the <a href="@link">documentation</a>.', array(
      '@link' => 'http://labs.engageinteractive.co.uk/itoggle/',
    )) . '</p>',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['advanced']['note'] = array(
    '#markup' => '<strong>' . t('Important') . '</strong><p>' . t("All of these callbacks are automatically wrapped in a closure, so you do don't need to specify it, just enter the code directly.") . '</p>',
  );
  $form['advanced']['example'] = array(
    '#markup' => '<p>' . t('For example') . ':</p><code>alert("onclick");</code></p>',
  );
  $form['advanced']['warning'] = array(
    '#markup' => '<strong>' . t('Warning') . '</strong><p>' . t('The callbacks are called using eval(), yes, we hate it too so please be careful!') . '</p>',
  );
  $form['advanced']['advanced_confirm'] = array(
    '#type' => 'checkbox',
    '#title' => t('I confirm that I have read the above warnings and wish to configure callbacks for iToggle'),
    '#default_value' => FALSE,
  );
  $form['advanced']['container'] = array(
    '#type' => 'container',
    '#states' => array(
      'invisible' => array(
        'input[name="advanced_confirm"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['advanced']['container']['itoggle_onclick'] = array(
    '#title' => t('OnClick callback'),
    '#type' => 'textarea',
    '#description' => t('Specify an OnClick callback for iToggle.'),
    '#default_value' => variable_get('itoggle_onclick', ''),
  );
  $form['advanced']['container']['itoggle_onclickon'] = array(
    '#title' => t('OnClickOn callback'),
    '#type' => 'textarea',
    '#description' => t('Specify an OnClickOn callback for iToggle.'),
    '#default_value' => variable_get('itoggle_onclickon', ''),
  );
  $form['advanced']['container']['itoggle_onclickoff'] = array(
    '#title' => t('OnClickOff callback'),
    '#type' => 'textarea',
    '#description' => t('Specify an OnClickOff callback for iToggle.'),
    '#default_value' => variable_get('itoggle_onclickoff', ''),
  );
  $form['advanced']['container']['itoggle_onslide'] = array(
    '#title' => t('OnSlide callback'),
    '#type' => 'textarea',
    '#description' => t('Specify an OnSlide callback for iToggle.'),
    '#default_value' => variable_get('itoggle_onslide', ''),
  );
  $form['advanced']['container']['itoggle_onslideon'] = array(
    '#title' => t('OnSlideOn callback'),
    '#type' => 'textarea',
    '#description' => t('Specify an OnSlideOn callback for iToggle.'),
    '#default_value' => variable_get('itoggle_onslideon', ''),
  );
  $form['advanced']['container']['itoggle_onslideoff'] = array(
    '#title' => t('OnSlideOff callback'),
    '#type' => 'textarea',
    '#description' => t('Specify an OnSlideOff callback for iToggle.'),
    '#default_value' => variable_get('itoggle_onslideoff', ''),
  );
  return system_settings_form($form);
}