You are here

function mobile_number_views_data_alter in Mobile Number 7

Implements hook_views_data_alter().

File

./mobile_number.module, line 636
mobile_number.module

Code

function mobile_number_views_data_alter(&$data) {
  $fields = field_read_fields(array(
    'type' => 'mobile_number',
  ));
  foreach ($fields as $field_id => $field) {
    if (!empty($field['storage']['details']['sql']['FIELD_LOAD_CURRENT'])) {
      $table = key($field['storage']['details']['sql']['FIELD_LOAD_CURRENT']);
      $data[$table][$field_id . '_verified']['filter']['handler'] = 'views_handler_filter_boolean_operator';
      $data[$table][$field_id . '_country']['filter']['handler'] = 'views_handler_filter_in_operator';
      $data[$table][$field_id . '_country']['filter']['options callback'] = 'mobile_number_views_country_options';
    }
    if (!empty($field['storage']['details']['sql']['FIELD_LOAD_REVISION'])) {
      $table_revision = key($field['storage']['details']['sql']['FIELD_LOAD_REVISION']);
      $data[$table_revision][$field_id . '_verified']['filter']['handler'] = 'views_handler_filter_boolean_operator';
      $data[$table_revision][$field_id . '_country']['filter']['handler'] = 'views_handler_filter_in_operator';
      $data[$table_revision][$field_id . '_country']['filter']['options callback'] = 'mobile_number_views_country_options';
    }
  }
}