function uc_product_handler_field_price::render in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_product/views/uc_product_handler_field_price.inc \uc_product_handler_field_price::render()
Overrides views_handler_field::render().
File
- uc_product/
views/ uc_product_handler_field_price.inc, line 81 - Views handler: Product price field.
Class
- uc_product_handler_field_price
- Returns a formatted price value to display in the View.
Code
function render($values) {
if ($this->options['format'] == 'numeric') {
return parent::render($values);
}
if ($this->options['format'] == 'uc_price') {
if (is_null($values->{$this->field_alias})) {
return '';
}
$product = node_load($values->{$this->aliases['nid']});
if ($product->{$this->real_field} == 0 && $this->options['empty_zero']) {
return '';
}
$context = array(
'revision' => $this->options['revision'],
'type' => 'product',
'class' => array(
'product',
$this->field,
),
'field' => $this->real_field,
'subject' => array(
'node' => $product,
),
);
$options = array(
'label' => FALSE,
);
return uc_price($product->{$this->real_field}, $context, $options);
}
}