You are here

class uc_views_attribute_handler_field_order_product_attribute in Ubercart Views 6.3

Field handler to provide a human-readable version of the selected combination of attributes

Hierarchy

Expanded class hierarchy of uc_views_attribute_handler_field_order_product_attribute

1 string reference to 'uc_views_attribute_handler_field_order_product_attribute'
uc_views_attribute_views_data in uc_views_attribute/views/uc_views_attribute.views.inc
Implementation of hook_views_data().

File

uc_views_attribute/views/uc_views_attribute_handler_field_order_product_attribute.inc, line 6

View source
class uc_views_attribute_handler_field_order_product_attribute extends views_handler_field {

  /**
   * Defines a few default options for the combination field
   */
  function option_definition() {
    $options = parent::option_definition();
    return $options;
  }
  function render($values) {
    $data = unserialize($values->{$this->field_alias});
    $result = "";
    if (is_array($data['attributes'])) {
      $result = '';
      $rows = array();
      foreach ($data['attributes'] as $attribute => $option) {
        $rows[] = t('@attribute: @option', array(
          '@attribute' => $attribute,
          '@option' => implode(', ', (array) $option),
        ));
        if (count($rows)) {
          $result = theme('item_list', $rows, NULL, 'ul', array(
            'class' => 'product-description',
          ));
        }
      }
    }
    return $result;
  }

}

Members