Skip navigation
Help

theme_uc_attribute_add_to_cart

6 uc_attribute.module theme_uc_attribute_add_to_cart($form)
7 uc_attribute.theme.inc theme_uc_attribute_add_to_cart($variables)

Displays the attribute selection form elements.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

See also

_uc_attribute_alter_form()

Related topics

File

ubercart/uc_attribute/uc_attribute.theme.inc, line 40
Theme functions for the uc_attribute module.

Code

function theme_uc_attribute_add_to_cart($variables) {
  $form = $variables['form'];

  $output = '<div id="' . $form['#id'] . '" class="attributes">';
  $stripes = array(
    'even' => 'odd',
    'odd' => 'even',
  );
  $parity = 'even';
  foreach (element_children($form) as $aid) {
    $parity = $stripes[$parity];
    $classes = array('attribute', 'attribute-' . $aid, $parity);
    $output .= '<div class="' . implode(' ', $classes) . '">';
    $output .= drupal_render($form[$aid]);
    $output .= '</div>';
  }

  $output .= drupal_render_children($form) . '</div>';

  return $output;
}