You are here

function theme_uc_attribute in Ubercart 5

Display formatted of data associated with attributes

Parameters

$type: options | attributes Determines how to handle the $data array.

$data: An array of attribute ids or option ids. If option ids, they are indexed by attribute ids.

Return value

HTML format of $data.

File

uc_attribute/uc_attribute.module, line 1420

Code

function theme_uc_attribute($type, $data, $nid) {
  if ($type == 'options' && is_array($data)) {
    if (count($data)) {
      $output = '<ul class="options">';
      foreach ($data as $aid => $oid) {
        $attribute = uc_attribute_load($aid);
        $option = $attribute->options[$oid];
        $output .= '<li>' . $option->name . '</li>';
      }
      $output .= '</ul>';
    }
  }
  elseif ($type == 'attributes') {
    if (is_array($data) && count($data)) {
      $output = '<div id="option_key">';
      foreach ($data as $aid) {
        $output .= theme('uc_attribute_options', $aid, $nid);
      }
      $output .= '</div>';
    }
    elseif (is_numeric($data)) {
      $output = '<div id="option_key">';
      $output .= theme('uc_attribute_options', $data);
      $output .= '</div>';
    }
  }
  return $output;
}