You are here

function itoggle_form_admin in iToggle 7

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

@file iToggle Admin config pages.

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

File

includes/itoggle.admin.inc, line 7
iToggle Admin config pages.

Code

function itoggle_form_admin() {
  $form = array();
  $itoggle_path = itoggle_get_path();
  $form['itoggle']['basic'] = array(
    '#type' => 'fieldset',
    '#title' => t('Basic Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['itoggle']['basic']['itoggle_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Path'),
    '#default_value' => $itoggle_path,
    '#description' => t('The location where iToggle plugin is installed. Relative paths are from the Drupal root directory.'),
    '#after_build' => array(
      '_itoggle_admin_check_plugin_path',
    ),
  );
  $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_value('itoggle_compression_type'),
  );
  $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_value('itoggle_css'),
  );
  $form['itoggle']['basic']['itoggle_easing'] = array(
    '#type' => 'textfield',
    '#title' => t('Easing'),
    '#description' => t('If you installed the <a href="@link">Easing</a> jQuery plugin you can specify an easing function for iToggle here. Warning, if Easing is not installed properly, this will break things!', array(
      '@link' => 'http://gsgd.co.uk/sandbox/jquery/easing/',
    )),
    '#default_value' => variable_get_value('itoggle_easing'),
  );
  $form['itoggle']['basic']['itoggle_speed'] = array(
    '#type' => 'textfield',
    '#size' => 6,
    '#title' => t('Speed'),
    '#description' => t('iToggle animation speed, in milliseconds. Default is 200.'),
    '#default_value' => variable_get_value('itoggle_speed'),
  );
  $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_value('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_value('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_value('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_value('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_value('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_value('itoggle_onslideoff'),
  );
  return system_settings_form($form);
}