function theme_webform_date_matrix in Webform Matrix Component 7.4
Same name and namespace in other branches
- 6 components/matrix.inc \theme_webform_date_matrix()
- 7 components/matrix.inc \theme_webform_date_matrix()
- 7.2 components/matrix.inc \theme_webform_date_matrix()
- 7.3 components/matrix.inc \theme_webform_date_matrix()
Theme for date subcomponent for matrix.
1 theme call to theme_webform_date_matrix()
- webform_matrix_component_form_alter in ./
webform_matrix_component.module - Implements hook_form_alter().
File
- components/
matrix.inc, line 450 - Webform module matrix component.
Code
function theme_webform_date_matrix($variables) {
drupal_add_js(drupal_get_path('module', 'webform') . '/js/webform.js');
$element = $variables['element'];
$element['year']['#attributes']['class'] = array(
'year',
);
$element['month']['#attributes']['class'] = array(
'month',
);
$element['day']['#attributes']['class'] = array(
'day',
);
// Add error classes to all items within the element.
if (form_get_error($element)) {
$element['year']['#attributes']['class'][] = 'error';
$element['month']['#attributes']['class'][] = 'error';
$element['day']['#attributes']['class'][] = 'error';
}
$class = array(
'webform-container-inline',
);
// Add the JavaScript calendar if available (provided by Date module package).
if (!empty($element['#datepicker'])) {
$class[] = 'webform-datepicker';
$calendar_class = array(
'webform-calendar',
);
if ($element['#start_date']) {
$calendar_class[] = 'webform-calendar-start-' . $element['#start_date'];
}
if ($element['#end_date']) {
$calendar_class[] = 'webform-calendar-end-' . $element['#end_date'];
}
$calendar_class[] = 'webform-calendar-day-' . variable_get('date_first_day', 0);
$calendar = theme('webform_calendar', array(
'component' => NULL,
'calendar_classes' => $calendar_class,
));
}
$output = '';
$output .= '<div class="' . implode(' ', $class) . '">';
$output .= drupal_render_children($element);
$output .= isset($calendar) ? $calendar : '';
$output .= '</div>';
return $output;
}