Created
August 3, 2014 06:57
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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