You are here

function jquery_ui_multiselect_widget_settings_form in jQuery UI MultiSelect Widget 7

jquery_ui_multiselect_widget.admin settings form.

1 string reference to 'jquery_ui_multiselect_widget_settings_form'
jquery_ui_multiselect_widget_menu in ./jquery_ui_multiselect_widget.module
Implements hook_load_menu().

File

./jquery_ui_multiselect_widget.admin.inc, line 11
JQuery jQuery UI MultiSelect Widget admin/configuration functionality.

Code

function jquery_ui_multiselect_widget_settings_form() {
  $module_path = drupal_get_path('module', 'jquery_ui_multiselect_widget');

  // Selector
  $form['jquery_ui_multiselect_widget_multiple'] = array(
    '#type' => 'checkbox',
    '#title' => t('Multiple ([multiple=multiple]) selects only'),
    '#description' => t("Only use jQuery UI MultiSelect Widget on select's with attribute '[multiple=multiple]' activated (select multiple values). Leave single selects untouched."),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_multiple', FALSE),
  );
  $form['jquery_ui_multiselect_widget_filter'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Filter functionality'),
    '#description' => t("Uses the additional !filterplugin functionality to let the user search in the selectable values for easier selection.", array(
      '!filterplugin' => l(t('Filter Plugin'), 'http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/index.htm#filter'),
    )),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_filter', FALSE),
  );

  // Filter Settings
  $form['jquery_ui_multiselect_widget_filter_width'] = array(
    '#type' => 'textfield',
    '#size' => 5,
    '#title' => t('Filter: Width'),
    '#required' => FALSE,
    '#description' => t("The width of the input in pixels. Defaults to '100' (px) in the style sheet, but you can override this for each instance. Must be numeric (always px) due to limitations in the original Plugin."),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_filter_width'),
    '#states' => array(
      'visible' => array(
        "input[name='jquery_ui_multiselect_widget_filter']" => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['jquery_ui_multiselect_widget_filter_auto_reset'] = array(
    '#type' => 'checkbox',
    '#title' => t('Filter: Auto Reset'),
    '#required' => FALSE,
    '#description' => t("A boolean value denoting whether or not to reset the search box & any filtered options when the widget closes. Defaults to false."),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_filter_auto_reset', FALSE),
    '#states' => array(
      'visible' => array(
        "input[name='jquery_ui_multiselect_widget_filter']" => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );

  // Subselector
  $form['jquery_ui_multiselect_widget_subselector'] = array(
    '#type' => 'textfield',
    '#title' => t('JQuery subselector'),
    '#description' => t("You may optionally use this subselector to reduce the '<select>' DOM context which to use jQuery UI Multiselect Widget on. For example add '.my-select' to only use for selects with this class."),
    '#required' => FALSE,
    '#default_value' => variable_get('jquery_ui_multiselect_widget_subselector', ''),
  );

  // Exclude
  $form['jquery_ui_multiselect_widget_path_match_exclude'] = array(
    '#type' => 'textarea',
    '#title' => t('Exclude the following path(s)'),
    '#description' => t("The widget will NOT be used for paths that match these patterns. This is used ADDITIONALLY to the subselector option.") . ' ' . t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page. Default: @default", array(
      "@default" => nl2br("admin/*\nmedia/*\nfile/*\nsystem/ajax"),
    )),
    '#required' => FALSE,
    '#default_value' => variable_get('jquery_ui_multiselect_widget_path_match_exclude', ''),
  );

  // Options
  $form['jquery_ui_multiselect_widget_header'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display Header'),
    '#description' => t("Either a boolean value denoting whether or not to display the header, or a string value. If you pass a string, the default “check all”, “uncheck all”, and “close” links will be replaced with the specified text."),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_header', TRUE),
  );
  $form['jquery_ui_multiselect_widget_autoOpen'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically open on init'),
    '#description' => t("Automatically open the menu when the widget has been initialized."),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_autoOpen', TRUE),
  );
  $form['jquery_ui_multiselect_widget_height'] = array(
    '#type' => 'textfield',
    '#size' => 5,
    '#title' => t('Height'),
    '#required' => TRUE,
    '#description' => t("Height of the checkbox container (scroll area) in pixels. If set to “auto”, the height will calculate based on the number of checkboxes in the menu."),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_height'),
  );
  $form['jquery_ui_multiselect_widget_classes'] = array(
    '#type' => 'textfield',
    '#title' => t('Additional classes'),
    '#description' => t("Additional class(es) to apply to BOTH the button and menu for further customization. Separate multiple classes\nwith a space."),
    '#required' => FALSE,
    '#default_value' => variable_get('jquery_ui_multiselect_widget_classes', ''),
  );
  $form['jquery_ui_multiselect_widget_selectedlist'] = array(
    '#type' => 'textfield',
    '#size' => 2,
    '#title' => t('Selected List'),
    '#required' => TRUE,
    '#description' => t("A numeric (or zero to disable) value denoting whether or not to display the checked opens in a list, and how many. A number greater than 0 denotes the maximum number of list items to display before switching over to the selectedText parameter."),
    '#default_value' => variable_get('jquery_ui_multiselect_widget_selectedlist', 4),
  );
  return system_settings_form($form);
}