You are here

function uniform_admin_settings in Uniform 7

Same name and namespace in other branches
  1. 6 uniform.module \uniform_admin_settings()
  2. 7.2 uniform.module \uniform_admin_settings()
1 string reference to 'uniform_admin_settings'
uniform_menu in ./uniform.module
Implements hook_menu().

File

./uniform.module, line 27
Module for displaying sexy forms using jQuery. This module uses jQuery to theme html forms.

Code

function uniform_admin_settings() {

  // get path to uniform
  $path = libraries_get_path('uniform');

  // scan for themes
  $uthemes = file_scan_directory('./' . $path . '/css', '/.css/', array(
    'nomask' => '/(\\.\\.?|CVS)$/',
  ));

  // get currently set theme from {variable} table
  $deftheme = variable_get('uniform_theme', 'default');

  // create array of themes for select options
  $options = array();
  foreach ($uthemes as $key => $data) {
    list(, $option) = explode('.', $data->name);
    $options[$option] = drupal_ucfirst($option) . ' ' . t('theme');
  }

  // build select
  $form['uniform_theme'] = array(
    '#type' => 'select',
    '#title' => t('Uniform theme'),
    '#default_value' => $deftheme,
    '#options' => $options,
    '#description' => t('Select your desired theme.'),
  );

  // checkboxes for form elements to be themed
  $form['uniform_elements'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Form elements'),
    '#default_value' => variable_get('uniform_elements', array()),
    '#options' => array(
      'button' => t('Button: HTML Tag'),
      'input:button' => t('Button: Input'),
      'input:submit' => t('Button: Submit '),
      'input:checkbox' => t('Checkbox'),
      'input:file' => t('File field'),
      'input:password' => t('Password'),
      'input:radio' => t('Radio'),
      'textarea' => t('Textarea'),
      'input:text' => t('Text field'),
      //      'input:search' => t('Search'),
      'select' => t('Select'),
    ),
    '#description' => t('Select the form elements you would like to be themed.'),
  );

  // string of jQuery selectors to be excluded
  $form['uniform_not_selectors'] = array(
    '#type' => 'textarea',
    '#title' => t('Exclude Selectors'),
    '#default_value' => variable_get('uniform_not_selectors', ''),
    '#description' => t('Enter a comma separated list of jQuery selectors you want to exclude from Uniform theming, these will be excluded using the jQuery <a href="http://api.jquery.com/not/">.not()</a> API call.'),
  );

  // optionally disable in Admin section
  $form['uniform_admin'] = array(
    '#type' => 'select',
    '#title' => t('Administration Areas'),
    '#default_value' => variable_get('uniform_admin', 'su'),
    '#options' => array(
      'su' => t('Enable Uniform'),
      'hu' => t('Disable Uniform'),
    ),
    '#description' => t('Select Disable Uniform if you don\'t want Uniform to apply on forms in the administration area.'),
  );

  // optionally disable on node add/edit forms
  $form['uniform_node'] = array(
    '#type' => 'select',
    '#title' => t('Node forms'),
    '#default_value' => variable_get('uniform_node', 'su'),
    '#options' => array(
      'su' => t('Enable Uniform'),
      'hu' => t('Disable Uniform'),
    ),
    '#description' => t('Select Disable Uniform if you don\'t want Uniform to apply on node edit/add forms.'),
  );
  return system_settings_form($form);
}