You are here

function profile_views_add_sort in Views (for Drupal 7) 5

Add profile fields to sort table

1 call to profile_views_add_sort()
profile_views_tables in modules/views_profile.inc
This include file implements views functionality on behalf of profile.module

File

modules/views_profile.inc, line 119

Code

function profile_views_add_sort(&$table, $field) {
  $name = 'value';
  $label = t('Profile: @field-name', array(
    '@field-name' => $field->title,
  ));
  $others = array();
  switch ($field->type) {
    case 'vocabulary':
      $help = t('This allows you to sort by vocabulary terms');
      break;
    case 'selection':
      $help = t('This allows you to sort by selection options');
      break;
    case 'date':
      $other = array(
        'handler' => 'views_handler_sort_profile_date',
      );
      $help = t('This allows you to sort by date');
      break;
    case 'checkbox':
      $help = t('This allows you to sort yes/no');
      break;
    default:
      $help = '';
  }
  views_table_add_sort($table, $name, $label, $help, $others);
}