function commerce_reports_form_views_exposed_form_alter in Commerce Reporting 7
Same name and namespace in other branches
- 7.4 commerce_reports.module \commerce_reports_form_views_exposed_form_alter()
- 7.3 commerce_reports.module \commerce_reports_form_views_exposed_form_alter()
This will add the Google Chart tools Change the date format on all views-exposed forms
See also
http://code.google.com/apis/chart/interactive/docs/index.html
File
- ./
commerce_reports.module, line 158 - Defines additional menu item and order reports functionality.
Code
function commerce_reports_form_views_exposed_form_alter(&$form, $form_state) {
if ($form_state['view']->name == 'order_report') {
$form['#attached']['js'][] = array(
'data' => 'https://www.google.com/jsapi',
'type' => 'external',
);
$form['#attached']['js'][] = array(
'data' => "(function (\$) { google.load('visualization', '1.0', {'packages':['corechart']}); })(jQuery);",
'type' => 'inline',
);
$form['#attached']['js'][] = array(
'data' => drupal_get_path('module', 'commerce_reports') . '/commerce_reports.js',
'type' => 'file',
);
$form['#attached']['css'] = array(
'data' => drupal_get_path('module', 'commerce_reports') . '/commerce_reports.css',
'type' => 'file',
);
$form['created']['min']['#type'] = 'date_popup';
$form['created']['min']['#date_format'] = 'Y-m-d';
$form['created']['max']['#type'] = 'date_popup';
$form['created']['max']['#date_format'] = 'Y-m-d';
}
}