Skip navigation
Help

theme_uc_product_attributes

6 uc_attribute.admin.inc theme_uc_product_attributes($element)
7 uc_attribute.admin.inc theme_uc_product_attributes($variables)

Returns a themed set of attribute options for use in order displays.

Parameters

$variables: An associative array containing:

  • attributes: An associative array containing the set of attributes, with each element keyed by attribute ID:

    • <aid>: An associative array containing:

      • #attribute_name: Attribute name.
      • #options: Array of option names.

Return value

Themed set of attribute options.

Related topics

File

ubercart/uc_attribute/uc_attribute.admin.inc, line 1079
Attribute administration menu items.

Code

function theme_uc_product_attributes($variables) {
  $attributes = $variables['attributes'];

  $option_rows = array();

  foreach (element_children($attributes) as $key) {
    $optionstr = '';

    foreach ((array) $attributes[$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));
      }
    }

    if ($optionstr != '') {
      $option_rows[$key] = t('@attribute: @option', array('@attribute' => $attributes[$key]['#attribute_name'], '@option' => $optionstr));
    }
  }

  if (!empty($option_rows)) {
    return theme('item_list', array('items' => array_values($option_rows), 'attributes' => array('class' => array('product-description'))));
  }

  return '';
}