function commerce_price_field_widget_settings_form in Commerce Core 7
Implements hook_field_widget_settings_form().
File
- modules/
price/ commerce_price.module, line 586 - Defines the Price field with widgets and formatters used to add prices with currency codes to various Commerce entities.
Code
function commerce_price_field_widget_settings_form($field, $instance) {
$form = array();
// Build an options array of allowed currency values including the option for
// the widget to always use the store's default currency.
$options = array(
'default' => t('- Default store currency -'),
);
foreach (commerce_currencies(TRUE) as $currency_code => $currency) {
$options[$currency_code] = t('@code - @name', array(
'@code' => $currency['code'],
'@name' => $currency['name'],
));
}
$form['currency_code'] = array(
'#type' => 'select',
'#title' => $instance['widget']['type'] == 'commerce_price_simple' ? t('Currency') : t('Default currency'),
'#options' => $options,
'#default_value' => $instance['widget']['settings']['currency_code'],
);
return $form;
}