| 14 |
parent::options($options); |
parent::options($options); |
| 15 |
|
|
| 16 |
$options['format'] = 'uc_price'; |
$options['format'] = 'uc_price'; |
| 17 |
|
$options['revision'] = 'themed'; |
| 18 |
} |
} |
| 19 |
|
|
| 20 |
function options_form(&$form, &$form_state) { |
function options_form(&$form, &$form_state) { |
| 33 |
'#weight' => 1, |
'#weight' => 1, |
| 34 |
); |
); |
| 35 |
|
|
| 36 |
|
$form['revision'] = array( |
| 37 |
|
'#title' => t('Revision'), |
| 38 |
|
'#type' => 'select', |
| 39 |
|
'#options' => array( |
| 40 |
|
'original' => t('Original'), |
| 41 |
|
'altered' => t('Altered'), |
| 42 |
|
'formatted-original' => t('Formatted original'), |
| 43 |
|
'formatted' => t('Formatted'), |
| 44 |
|
'themed-original' => t('Themed original'), |
| 45 |
|
'themed' => t('Themed'), |
| 46 |
|
), |
| 47 |
|
'#default_value' => $options['revision'], |
| 48 |
|
'#process' => array('views_process_dependency'), |
| 49 |
|
'#dependency' => array('radio:options[format]' => array('uc_price')), |
| 50 |
|
'#weight' => 1, |
| 51 |
|
); |
| 52 |
|
|
| 53 |
// Change weight and dependency of the previous field on the parent numeric ones |
// Change weight and dependency of the previous field on the parent numeric ones |
| 54 |
$weight = 2; |
$weight = 2; |
| 55 |
foreach (array('set_precision', 'precision', 'decimal', 'separator', 'prefix', 'suffix') as $field) { |
foreach (array('set_precision', 'precision', 'decimal', 'separator', 'prefix', 'suffix') as $field) { |
| 67 |
} |
} |
| 68 |
} |
} |
| 69 |
|
|
|
function query() { |
|
|
$this->ensure_my_table(); |
|
|
$this->add_additional_fields(); |
|
|
} |
|
|
|
|
| 70 |
function render($values) { |
function render($values) { |
| 71 |
if ($this->options['format'] == 'numeric') { |
if ($this->options['format'] == 'numeric') { |
| 72 |
return parent::render($values); |
return parent::render($values); |
| 75 |
if ($this->options['format'] == 'uc_price') { |
if ($this->options['format'] == 'uc_price') { |
| 76 |
$product = node_load($values->{$this->aliases['nid']}); |
$product = node_load($values->{$this->aliases['nid']}); |
| 77 |
$context = array( |
$context = array( |
| 78 |
'revision' => 'themed', |
'revision' => $this->options['revision'], |
| 79 |
'type' => 'product', |
'type' => 'product', |
| 80 |
'class' => array( |
'class' => array( |
| 81 |
'product', |
'product', |