Professional Documents
Culture Documents
4. Within the views subdirectory, you will need to create two files, MODULE.views.inc and
MODULE_handler_filter_FILTERNAME.inc
5. In MODULE.views.inc, you will need to implement either hook_views_data_alter() (for a
new filter on an existing entity type that already has views integration, which is more
common) or hook_views_data() (to provide views integration for your custom entity,
including filters). API documentation is available for both functions. A quick example:
function MODULE_views_data_alter(&$data) {
if ( isset($data['users']) && !isset($data['users']['FILTERNAME']) ) {
$data['users']['FILTERNAME'] = array(
'real field' => 'uid', // name of entity field to which filter applies
'title' => t('HUMAN READABLE NAME OF FILTER'),
'help' => t('HELP TEXT'),
'filter' => array(
'handler' => 'MODULE_handler_filter_FILTERNAME',
),
);
}
}
1 of 1