NEWS
January 21, 2024
I’m sure we’ve all been here, having a problem with Views and having the need to override them; a common situation where I face this, is while using special case Views with “i18n”, for that, here are the five steps I use to override Views.
includes/views/YOUR_MODULE.views.inc includes/views/handlers/YOUR_CUSTOM_CLASS.inc
<?php function YOUR_MODULE_views_api() { return array( 'api' => 3, 'path' => drupal_get_path('module', 'YOUR_MODULE') . '/includes/views', ); } ?>
files[] = includes/views/handlers/ YOUR_CUSTOM_CLASS.inc files[] = includes/views/YOUR_MODULE.views.inc
<?php function YOUR_MODULE_views_data_alter(&$data) { $data['taxonomy_term_data']['tid_representative'] ['relationship']['handler'] = 'YOUR_CUSTOM_CLASS'; } ?>
<?php class YOUR_CUSTOM_CLASS extends views_handler_OLD_CLASS { //override your function } ?>