addressfield.views.inc 667 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Implements hook_field_views_data().
  4. */
  5. function addressfield_field_views_data($field) {
  6. $data = field_views_field_default_views_data($field);
  7. // Add a handler for countries.
  8. foreach ($field['storage']['details']['sql'] as $type => $tables) {
  9. foreach ($tables as $table_name => $columns) {
  10. if (!isset($columns['country'])) {
  11. continue;
  12. }
  13. $column_real_name = $columns['country'];
  14. if (!isset($data[$table_name][$column_real_name]['filter'])) {
  15. continue;
  16. }
  17. $data[$table_name][$column_real_name]['filter']['handler'] = 'addressfield_views_handler_filter_country';
  18. }
  19. }
  20. return $data;
  21. }