I have a view that includes a date field that only uses the year part. I want provide a default filter value for this field based on the current date. So far, I have this
function results_view_views_pre_view(&$view, &$display_id, &$args) {
if($view->name == 'results_view') {
$year = date("Y");
$view->display['default']->handler->options['title'] = $year . ' Results';
$view->display['page']->handler->options['filters']['field_season_value']['value']['value'] = = $year;
}
}
This doesn't throw any errors but the filter view isn't filtered
I'm not sure what I'm doing wrong here, or if I'm even going down the right path. The value I assigned above is based on the fact that when I hard code the year into my view, the view object looks like this
[field_season_value] => Array
(
[id] => field_season_value
[table] => field_data_field_season
[field] => field_season_value
[relationship] => none
[group_type] => group
[ui_name] =>
[operator] => =
[value] => Array
(
[min] =>
[max] =>
[value] => 2013
[type] => date
)
Just to clarify, the date field is based on a fiscal year that runs September through August. So if its May 2013, the date would need to be 2012. My example above is just a simplified version if what I'm going to need to do in the final version.
now
via gui? – Mołot May 17 '13 at 22:22