Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@msankhala
Created August 3, 2014 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msankhala/1fff9a4f00d8a1ee30c4 to your computer and use it in GitHub Desktop.
Save msankhala/1fff9a4f00d8a1ee30c4 to your computer and use it in GitHub Desktop.
Hook_views_field_data_alter(). implement this hook if you want to modify the handler for any field provided by field api. Otherwise use Hook_views_data_() if you want to expose new table to view.
<?php
/**
* Implements hook_field_views_data_alter().
*/
function MYMODULE_field_views_data_alter(&$result, $field, $module) {
if ($field['field_name'] == 'FIELD_NAME') {
$name = $field['field_name'];
foreach ($result as $table_name => $table_data) {
if (isset($table_data[$field['field_name']]['field'])) {
// HERE modifying filter handler. But we can modify sort, field, contextual filter and argument handler in same way
$result[$table_name][$field['field_name'] . '_value']['filter']['handler'] = 'FILTER_HANDLER_NAME_IN_SEPARATE_FIEL';
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment