[support] Custom timestamp field in views filter

Joel Willers joel.willers at sigler.com
Fri Jun 22 12:11:56 UTC 2012


Thanks for responding with the solution to your problem. That's very helpful.

Thanks!

Joel 

From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On Behalf Of Selvam S
Sent: Friday, June 22, 2012 1:42 AM
To: support at drupal.org
Subject: Re: [support] Custom timestamp field in views filter


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
429/1A CTH Road, Chennai - 600 032, India.
Tel: + 91 44 4213 4450 | Mob: +91 9566128631
http://knackforge.com



More information about the support mailing list