You are here

function ctools_export_ui::list_form in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 plugins/export_ui/ctools_export_ui.class.php \ctools_export_ui::list_form()

Create the filter/sort form at the top of a list of exports.

This handles the very default conditions, and most lists are expected to override this and call through to parent::list_form() in order to get the base form and then modify it as necessary to add search gadgets for custom fields.

2 calls to ctools_export_ui::list_form()
ctools_custom_content_ui::list_form in ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php
Create the filter/sort form at the top of a list of exports.
stylizer_ui::list_form in stylizer/plugins/export_ui/stylizer_ui.class.php
Create the filter/sort form at the top of a list of exports.
2 methods override ctools_export_ui::list_form()
ctools_custom_content_ui::list_form in ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php
Create the filter/sort form at the top of a list of exports.
stylizer_ui::list_form in stylizer/plugins/export_ui/stylizer_ui.class.php
Create the filter/sort form at the top of a list of exports.

File

plugins/export_ui/ctools_export_ui.class.php, line 235

Class

ctools_export_ui
Base class for export UI.

Code

function list_form(&$form, &$form_state) {

  // This forces the form to *always* treat as submitted which is
  // necessary to make it work.
  $form['#token'] = FALSE;
  if (empty($form_state['input'])) {
    $form["#post"] = TRUE;
  }

  // Add the 'q' in if we are not using clean URLs or it can get lost when
  // using this kind of form.
  if (!variable_get('clean_url', FALSE)) {
    $form['q'] = array(
      '#type' => 'hidden',
      '#value' => $_GET['q'],
    );
  }
  $all = array(
    'all' => t('- All -'),
  );
  $form['top row'] = array(
    '#prefix' => '<div class="ctools-export-ui-row ctools-export-ui-top-row clear-block">',
    '#suffix' => '</div>',
  );
  $form['bottom row'] = array(
    '#prefix' => '<div class="ctools-export-ui-row ctools-export-ui-bottom-row clear-block">',
    '#suffix' => '</div>',
  );
  $form['top row']['storage'] = array(
    '#type' => 'select',
    '#title' => t('Storage'),
    '#options' => $all + array(
      t('Normal') => t('Normal'),
      t('Default') => t('Default'),
      t('Overridden') => t('Overridden'),
    ),
    '#default_value' => 'all',
  );
  $form['top row']['disabled'] = array(
    '#type' => 'select',
    '#title' => t('Enabled'),
    '#options' => $all + array(
      '0' => t('Enabled'),
      '1' => t('Disabled'),
    ),
    '#default_value' => 'all',
  );
  $form['top row']['search'] = array(
    '#type' => 'textfield',
    '#title' => t('Search'),
  );
  $form['bottom row']['order'] = array(
    '#type' => 'select',
    '#title' => t('Sort by'),
    '#options' => $this
      ->list_sort_options(),
    '#default_value' => 'disabled',
  );
  $form['bottom row']['sort'] = array(
    '#type' => 'select',
    '#title' => t('Order'),
    '#options' => array(
      'asc' => t('Up'),
      'desc' => t('Down'),
    ),
    '#default_value' => 'asc',
  );
  $form['bottom row']['submit'] = array(
    '#type' => 'submit',
    '#id' => 'ctools-export-ui-list-items-apply',
    '#value' => t('Apply'),
    '#attributes' => array(
      'class' => 'ctools-use-ajax ctools-auto-submit-click',
    ),
  );
  $form['bottom row']['reset'] = array(
    '#type' => 'submit',
    '#id' => 'ctools-export-ui-list-items-apply',
    '#value' => t('Reset'),
    '#attributes' => array(
      'class' => 'ctools-use-ajax',
    ),
  );
  ctools_add_js('ajax-responder');
  ctools_add_js('auto-submit');
  drupal_add_js('misc/jquery.form.js');
  $form['#prefix'] = '<div class="clear-block">';
  $form['#suffix'] = '</div>';
  $form['#attributes'] = array(
    'class' => 'ctools-auto-submit-full-form',
  );
}