ensure_my_table(); // Add the field. $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']); } function option_definition() { $options = parent::option_definition(); $options['order'] = array('default' => 'ASC'); return $options; } /** * Display whether or not the sort order is ascending or descending */ function admin_summary() { switch ($this->options['order']) { case 'ASC': case 'asc': default: $type = t('asc'); break; case 'DESC'; case 'desc'; $type = t('desc'); break; } return '' . $type . ''; } /** * Basic options for all sort criteria */ function options_form(&$form, &$form_state) { $form['order'] = array( '#type' => 'radios', '#title' => t('Sort order'), '#options' => array('ASC' => t('Ascending'), 'DESC' => t('Descending')), '#default_value' => $this->options['order'], ); } } /** * A special handler to take the place of missing or broken handlers. */ class views_handler_sort_broken extends views_handler_sort { function ui_name($short = FALSE) { return t('Broken/missing handler'); } function ensure_my_table() { /* No table to ensure! */ } function query() { /* No query to run */ } function options_form(&$form, &$form_state) { $form['markup'] = array( '#prefix' => '