title.views.inc 757 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * Implements hook_views_data_alter().
  4. *
  5. * Replace field default handler (views_handler_field_field).
  6. */
  7. function title_field_views_data_alter(&$data) {
  8. foreach (entity_get_info() as $entity_type => $entity_info) {
  9. $replacements = title_field_replacement_info($entity_type);
  10. if ($replacements) {
  11. foreach ($replacements as $replacement) {
  12. if (isset($replacement['field']['field_name'])) {
  13. $field = field_info_field($replacement['field']['field_name']);
  14. $table = _field_sql_storage_tablename($field);
  15. if (isset($data[$table][$field['field_name']])) {
  16. $data[$table][$field['field_name']]['field']['handler'] = 'views_handler_title_field';
  17. }
  18. }
  19. }
  20. }
  21. }
  22. }