You are here

function mvf_handler_field_mvf::click_sortable in Measured Value Field 7

Determine if this field is click sortable.

Overrides views_handler_field_field::click_sortable

File

views/mvf_handler_field_mvf.inc, line 13
Definition of mvf_handler_field_mvf class.

Class

mvf_handler_field_mvf
Base Views Field Handler for field types defined in MVF module.

Code

function click_sortable() {
  if (!parent::click_sortable()) {
    return FALSE;
  }

  // Among other standard reasons not to be click sortable, MVF field column
  // many not be sortable if the measure's conversion is not linear. For non
  // standard convert callbacks we do not have any knowledge about how
  // conversion happens and thus we are hintless about how to sort it.
  $field = field_info_field($this->definition['field_name']);
  $measure = units_measure_machine_name_load(reset($field['settings']['unit']['handler_settings']['target_bundles']));
  return $measure->converter == 'linear';
}