function uc_product_handler_field_price::options_form 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::options_form()
Overrides views_handler::options_form().
File
- uc_product/
views/ uc_product_handler_field_price.inc, line 28 - Views handler: Product price field.
Class
- uc_product_handler_field_price
- Returns a formatted price value to display in the View.
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$options = $this->options;
$form['format'] = array(
'#title' => t('Format'),
'#type' => 'radios',
'#options' => array(
'uc_price' => t('Ubercart price'),
'numeric' => t('Numeric'),
),
'#default_value' => $options['format'],
'#weight' => 1,
);
$form['revision'] = array(
'#title' => t('Revision'),
'#type' => 'select',
'#options' => array(
'original' => t('Original'),
'altered' => t('Altered'),
'formatted-original' => t('Formatted original'),
'formatted' => t('Formatted'),
'themed-original' => t('Themed original'),
'themed' => t('Themed'),
),
'#default_value' => $options['revision'],
'#process' => array(
'views_process_dependency',
),
'#dependency' => array(
'radio:options[format]' => array(
'uc_price',
),
),
'#weight' => 1,
);
// Change weight and dependency of the previous field on the parent numeric ones
$weight = 2;
foreach (array(
'set_precision',
'precision',
'decimal',
'separator',
'prefix',
'suffix',
) as $field) {
$form[$field]['#process'] = array(
'views_process_dependency',
);
if (is_array($form[$field]['#dependency'])) {
$form[$field]['#dependency'] += array(
'radio:options[format]' => array(
'numeric',
),
);
$form[$field]['#dependency_count'] = count($form[$field]['#dependency']);
}
else {
$form[$field]['#dependency'] = array(
'radio:options[format]' => array(
'numeric',
),
);
}
$form[$field]['#weight'] = ++$weight;
}
}