function views_ui_list_views_form

2.x admin.inc views_ui_list_views_form(&$form_state)

Provide a form for sorting and filtering the list of views.

2 string references to 'views_ui_list_views_form'
template_preprocess_views_ui_list_views in includes/admin.inc
Preprocess the list views theme
views_ui_theme in ./views_ui.module

File

includes/admin.inc, line 219
admin.inc Provides the Views' administrative interface.

Code

function views_ui_list_views_form(&$form_state) {
  if (!variable_get('clean_url', FALSE)) {
    $form['q'] = array(
      '#type' => 'hidden',
      '#value' => $_GET['q'],
    );
  }

  $all = array('all' => t('- All -'));
  $none = array('none' => t('- None -'));

  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Storage'),
    '#options' => array(
      'all' => t('- All -'),
      t('Normal') => t('Normal'),
      t('Default') => t('Default'),
      t('Overridden') => t('Overridden'),
    ),
    '#default_value' => 'all',
  );

  $bases = array();
  foreach (views_fetch_base_tables() as $table => $info) {
    $bases[$table] = $info['title'];
  }

  $form['base'] = array(
    '#type' => 'select',
    '#title' => t('Type'),
    '#options' => array_merge($all, $bases),
    '#default_value' => 'all',
  );

  $tags = array();

  $extras = array();
  foreach ($form_state['views'] as $name => $view) {
    if (!empty($view->tag)) {
      $tags[$view->tag] = $view->tag;
    }
  }

  asort($tags);

  $form['tag'] = array(
    '#type' => 'select',
    '#title' => t('Tag'),
    '#options' => array_merge($all, $none, $tags),
    '#default_value' => 'all',
  );

  $displays = array();
  foreach (views_fetch_plugin_data('display') as $id => $info) {
    if (!empty($info['admin'])) {
      $displays[$id] = $info['admin'];
    }
  }

  asort($displays);

  $form['display'] = array(
    '#type' => 'select',
    '#title' => t('Displays'),
    '#options' => array_merge($all, $displays),
    '#default_value' => 'all',
  );

  $form['order'] = array(
    '#type' => 'select',
    '#title' => t('Sort by'),
    '#options' => array(
      'name' => t('Name'),
      'title' => t('Title'),
      'tag' => t('Tag'),
      'path' => t('Path'),
      'type' => t('Type'),
      'desc' => t('Description'),
    ),
    '#default_value' => 'name',
  );

  $form['sort'] = array(
    '#type' => 'select',
    '#title' => t('Order'),
    '#options' => array(
      'asc' => t('Up'),
      'desc' => t('Down'),
    ),
    '#default_value' => 'asc',
  );

  $form['submit'] = array(
    '#name' => '', // so it won't in the $_GET args
    '#type' => 'submit',
    '#id' => 'edit-views-apply',
    '#value' => t('Apply'),
  );

  if (!empty($_SESSION['views']['#admin'])) {
    $form['reset'] = array(
      '#type' => 'submit',
      '#id' => 'edit-views-reset',
      '#value' => t('Reset'),
    );
  }

  $form['#theme'] = array('views_ui_list_views_form');
  return $form;
}