uc_attribute.theme.inc in Ubercart 7.3
Same filename and directory in other branches
Theme functions for the uc_attribute module.
File
uc_attribute/uc_attribute.theme.incView source
<?php
/**
* @file
* Theme functions for the uc_attribute module.
*/
/**
* Displays an attribute option with an optional total or adjustment price.
*
* @param $variables
* An associative array containing:
* - option: The option name.
* - price: The price total or adjustment, if any.
*
* @return string
* The HTML output.
*
* @see _uc_attribute_alter_form()
* @ingroup themeable
*/
function theme_uc_attribute_option($variables) {
$output = $variables['option'];
if ($variables['price']) {
$output .= ', ' . $variables['price'];
}
return $output;
}
/**
* Displays the attribute selection form elements.
*
* @param $variables
* An associative array containing:
* - form: A render element representing the form.
*
* @see _uc_attribute_alter_form()
* @ingroup themeable
*/
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;
}
Functions
Name![]() |
Description |
---|---|
theme_uc_attribute_add_to_cart | Displays the attribute selection form elements. |
theme_uc_attribute_option | Displays an attribute option with an optional total or adjustment price. |