I have a custom entity “referral” which is available for views:
function mymodule_entity_info() { return array( 'referral' => array( 'label' => t('Referral'), 'controller class' => 'EntityAPIController', 'views controller class' => 'EntityDefaultViewsController', ... ), ); }
The mymodule_referral
table has a field referred_at
which is a timestamp (stored as an int); I’d like to add a filter on this field to my view. I’ve got it displaying and filtering correctly with hook_views_data_alter
and views_handler_*_date
, but I’d prefer popup date selectors.
I understand that the date_views
submodule of date
should do what I want, but I can’t find proper documentation on how to use it.
function mymodule_views_data_alter(&$data) { ... $data['mymodule_referral']['referred_at']['filter'] = array( 'real field' => 'referred_at', 'handler' => 'date_views_filter_handler', ); }
doesn’t seem to be sufficient, because it displays in the view edit page as
FILTER CRITERIA Referral: Referred_at (Missing date fields!) | Settings
If I open the settings there’s a compulsory field
DATE FIELD(S) * Select date field(s) to filter.
with no options to select.
The only reference I can find to the “Missing date fields!” error message talks about hook_date_api_fields
, but that hook doesn’t seem to exist in 7.
What configuration am I missing?