function theme_uc_product_attributes in Ubercart 6.2
Same name and namespace in other branches
- 8.4 uc_attribute/uc_attribute.theme.inc \theme_uc_product_attributes()
- 7.3 uc_attribute/uc_attribute.admin.inc \theme_uc_product_attributes()
Returns a themed set of attribute options for use in order displays.
Parameters
$element: Structured array containing the set of attributes with each element having a key of attribute ID and the following keys: #attribute_name - Attribute name #options - Array of option names
Return value
Themed set of attribute options.
2 theme calls to theme_uc_product_attributes()
- hook_product_description in docs/
hooks.php - Returns a structured array representing the given product's description.
- uc_attribute_product_description in uc_attribute/
uc_attribute.module - Implements hook_product_description().
File
- uc_attribute/
uc_attribute.admin.inc, line 1164 - Attribute administration menu items.
Code
function theme_uc_product_attributes($element) {
$option_rows = array();
foreach (element_children($element) as $key) {
$optionstr = '';
foreach ((array) $element[$key]['#options'] as $option) {
// We only need to allow translation from the second option onward
if (empty($optionstr)) {
$optionstr .= $option;
}
else {
$optionstr .= t(', !option', array(
'!option' => $option,
));
}
}
$option_rows[$key] = t('@attribute: @option', array(
'@attribute' => $element[$key]['#attribute_name'],
'@option' => $optionstr,
));
}
if (!empty($option_rows)) {
return theme('item_list', array_values($option_rows), NULL, 'ul', array(
'class' => 'product-description',
));
}
return '';
}