title.views.inc 741 B

123456789101112131415161718192021
  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. if (!empty($entity_info['field replacement'])) {
  10. foreach ($entity_info['field replacement'] as $replacement) {
  11. if (isset($replacement['field']['field_name'])) {
  12. $field = field_info_field($replacement['field']['field_name']);
  13. $table = _field_sql_storage_tablename($field);
  14. if (isset($data[$table][$field['field_name']])) {
  15. $data[$table][$field['field_name']]['field']['handler'] = 'views_handler_title_field';
  16. }
  17. }
  18. }
  19. }
  20. }
  21. }