In a theme you need to add css classes to the form element and add this code:

function foo_preprocess_webform_date(&$variables) {
  $variables['element']['year']['#attributes']['class'][] = 'foo-inline';
  $variables['element']['month']['#attributes']['class'][] = 'foo-inline';
  $variables['element']['day']['#attributes']['class'][] = 'foo-inline';
}

and this is just ignored because of:

/**
 * Theme a webform date element.
 */
function theme_webform_date($variables) {
  $element = $variables['element'];

  $element['year']['#attributes']['class'] = array('year');
  $element['month']['#attributes']['class'] = array('month');
  $element['day']['#attributes']['class'] = array('day');

This code need to be changed to:

/**
 * Theme a webform date element.
 */
function theme_webform_date($variables) {
  $element = $variables['element'];

  $element['year']['#attributes']['class'][] = 'year';
  $element['month']['#attributes']['class'][] = 'month';
  $element['day']['#attributes']['class'][] = 'day';
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

Aside naming a class just "day" or month MUST cause collisions. These classes should be prefixed with the module name.

hass’s picture

Status: Active » Needs review
FileSize
975 bytes
hass’s picture

Version: 7.x-3.9 » 7.x-3.x-dev

v3.19 was the start version

quicksketch’s picture

Priority: Major » Minor
Status: Needs review » Reviewed & tested by the community

Thanks, I'll put this in next time I'm committing patches.

quicksketch’s picture

Status: Reviewed & tested by the community » Needs review

Hm, actually I'm not sure about changing the class. We can't do that in the 3.x branch because it may break existing sites that used the previous markup.

hass’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
939 bytes

Patch without class name changes.

quicksketch’s picture

Thanks!

hass’s picture

Needs to go into 4.x, too.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Pushed to 7.x-3.x and 7.x-4.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.