[support] Custom timestamp field in views filter

Selvam S selvam at knackforge.com
Fri Jun 22 06:41:58 UTC 2012


On Mon, Jun 18, 2012 at 2:45 PM, Selvam S <selvam at knackforge.com> wrote:
>
> I have a views data table with timestamp field defined inside
> hook_views_data.
>
>   $data['ABC']['timestamp'] = array(
>     'title' => t('Timestamp'),
>     'help' => t('Date and time from unix timestamp.'),
>     'field' => array(
>       'handler' => 'views_handler_field_date',
>       'click sortable' => TRUE,
>     ),
>     'sort' => array(
>       'handler' => 'views_handler_sort_date',
>     ),
>     'filter' => array(
>       'handler' => 'views_handler_filter_date',
>     ),
>   );
>
> When adding exposed filter for that field from Views, date popup is not
> showing up. Instead a normal text field is appearing. I would like to know
> if there is a way to achieve what i desire.
>
>
Answering my own question, I used hook_form_alter() against
"views_exposed_form". Then added date popup type,

$form['FIELD_NAME']['min']['#type'] = 'date_popup'

It worked perfectly.

-- 
Regards,
Selvam
KnackForge Soft Solutions Pvt. Ltd.
Acquia Service Partner <http://knackforge.com/node/54>
429/1A CTH Road, Chennai - 600 032, India.
Tel: + 91 44 4213 4450 | Mob: +91 9566128631
http://knackforge.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120622/21bb4ee4/attachment.html 


More information about the support mailing list