You are here

public function stylizer_ui::list_form in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 stylizer/plugins/export_ui/stylizer_ui.class.php \stylizer_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.

Overrides ctools_export_ui::list_form

File

stylizer/plugins/export_ui/stylizer_ui.class.php, line 19

Class

stylizer_ui
UI class for Stylizer.

Code

public function list_form(&$form, &$form_state) {
  ctools_include('stylizer');
  parent::list_form($form, $form_state);
  $all = array(
    'all' => t('- All -'),
  );
  if (empty($this->base_types)) {

    // Give a warning about the missing base styles.
    drupal_set_message($this->plugin['strings']['message']['missing base type'], 'warning');
  }
  $types = $all;
  foreach ($this->base_types as $module => $info) {
    foreach ($info as $key => $base_type) {
      $types[$module . '-' . $key] = $base_type['title'];
    }
  }
  $form['top row']['type'] = array(
    '#type' => 'select',
    '#title' => t('Type'),
    '#options' => $types,
    '#default_value' => 'all',
    '#weight' => -10,
    '#attributes' => array(
      'class' => array(
        'ctools-auto-submit',
      ),
    ),
  );
  $plugins = ctools_get_style_bases();
  $form_state['style_plugins'] = $plugins;
  $options = $all;

  // @todo base should use $module . '-' . $name
  foreach ($plugins as $name => $plugin) {
    $options[$name] = $plugin['title'];
  }
  $form['top row']['base'] = array(
    '#type' => 'select',
    '#title' => t('Base'),
    '#options' => $all + $options,
    '#default_value' => 'all',
    '#weight' => -9,
    '#attributes' => array(
      'class' => array(
        'ctools-auto-submit',
      ),
    ),
  );
}