Skip to content

Instantly share code, notes, and snippets.

@keopx
Created October 22, 2014 10:02
Show Gist options
  • Save keopx/1e24ac464974eb2130d3 to your computer and use it in GitHub Desktop.
Save keopx/1e24ac464974eb2130d3 to your computer and use it in GitHub Desktop.
Use date filter for node created filter. With it we use date calendar and options.
<?php
function mymodule_views_data_alter(&$data) {
$data['node']['created'] = array(
'title' => t('Post date'), // The item it appears as on the UI,
'help' => t('The date the content was posted.'), // The help that appears on the UI,
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'date_views_filter_handler_simple', // Requires date.module.
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment