1 views_ui_base_views_wizard.php protected ViewsUiBaseViewsWizard::default_display_sorts_user($form, $form_state)

File

core/modules/views_ui/wizards/views_ui_base_views_wizard.php, line 759
Provides the interface and base class for Views Wizard plugins.

Class

ViewsUiBaseViewsWizard
A very generic Views Wizard class - can be constructed for any base table.

Code

protected function default_display_sorts_user($form, $form_state) {
  $sorts = array();

  // Don't add a sort if there is no form value or the user selected none as sort.
  if (!empty($form_state['values']['show']['sort']) && $form_state['values']['show']['sort'] != 'none') {
    list($column, $sort) = explode(':', $form_state['values']['show']['sort']);
    // Column either be a column-name or the table-columnn-ame.
    $column = explode('-', $column);
    if (count($column) > 1) {
      $table = $column[0];
      $column = $column[1];
    }
    else {
      $table = $this->base_table;
      $column = $column[0];
    }

    $sorts[$column] = array(
      'id' => $column,
      'table' => $table,
      'field' => $column,
      'order' => $sort,
    );
  }

  return $sorts;
}