Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In function hook_views_data_alter (views.api.php) the use example code to change the handler of the title field is
$data['node']['title']['handler'] = 'modulename_handlers_field_node_title';
If I am not missing something, the code should be
$data['node']['title']['field']['handler'] = 'modulename_handlers_field_node_title';
to have any effect at all. It may be useful to review the entire set of examples, as it's probably the very starting point to learn how to override handlers.
Comment | File | Size | Author |
---|---|---|---|
#10 | hook_views_data_alter-1946398-10.patch | 948 bytes | bdgreen |
#8 | hook_views_data_alter-1946398-8.patch | 1.03 KB | bdgreen |
Comments
Comment #1
dawehnerFeel free to provide a patch.
Comment #2
pamatt CreditAttribution: pamatt commentedHere it is. I also fixed a second similar error in the same hook declaration. I also changed some handler names for uniformity
Comment #3
pamatt CreditAttribution: pamatt commentedComment #4
pamatt CreditAttribution: pamatt commentedComment #5
pamatt CreditAttribution: pamatt commentedComment #6
dawehnerCommitted to 7.x-3.x. Thanks!
This patch can be in theory applied to Drupal 8.x as well.
Comment #7
dawehner.
Comment #8
bdgreen CreditAttribution: bdgreen commentedPorted Patch to Drupal 8.x
Comment #9
dawehnerFor drupal 8 this should look more like the following:
Comment #10
bdgreen CreditAttribution: bdgreen commentedThx Daniel. Revised patch attached.
Comment #11
dawehnergreat, thank you!
Comment #12
webchickCommitted and pushed to 8.x. Thanks!