You are here

public function ctools_export_ui::list_form_submit in Chaos Tool Suite (ctools) 7

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

Submit the filter/sort form.

This submit handler is actually responsible for building up all of the rows that will later be rendered, since it is doing the filtering and sorting.

For the most part, you should not need to override this method, as the fiddly bits call through to other functions.

File

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

Class

ctools_export_ui
Base class for export UI.

Code

public function list_form_submit(&$form, &$form_state) {

  // Filter and re-sort the pages.
  $plugin = $this->plugin;
  $prefix = ctools_export_ui_plugin_base_path($plugin);
  foreach ($this->items as $name => $item) {

    // Call through to the filter and see if we're going to render this
    // row. If it returns TRUE, then this row is filtered out.
    if ($this
      ->list_filter($form_state, $item)) {
      continue;
    }
    $operations = $this
      ->build_operations($item);
    $this
      ->list_build_row($item, $form_state, $operations);
  }

  // Now actually sort
  if ($form_state['values']['sort'] == 'desc') {
    arsort($this->sorts);
  }
  else {
    asort($this->sorts);
  }

  // Nuke the original.
  $rows = $this->rows;
  $this->rows = array();

  // And restore.
  foreach ($this->sorts as $name => $title) {
    $this->rows[$name] = $rows[$name];
  }
}