function commerce_order_compare_address_configure in Commerce Discount 7
Configuration callback for commerce_order_compare_address_configure.
Parameters
array $settings: An array of rules condition settings.
Return value
array; A form element array.
1 string reference to 'commerce_order_compare_address_configure'
File
- ./
commerce_discount.inline_conditions.inc, line 456 - Provides Inline Conditions integration for the Commerce Discount module.
Code
function commerce_order_compare_address_configure($settings) {
module_load_include('inc', 'commerce_order', 'commerce_order.rules');
// Need a list of all address fields on customer profile bundles.
$form['address_field'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#options' => commerce_order_address_field_options_list(),
'#title' => t('Address field'),
'#title_display' => 'invisible',
'#default_value' => !empty($settings['address_field']) ? $settings['address_field'] : FALSE,
'#require' => TRUE,
);
// Need a list of address component options to compare.
$form['address_component'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#options' => commerce_order_address_component_options_list(),
'#title' => t('Address component'),
'#title_display' => 'invisible',
'#default_value' => !empty($settings['address_component']) ? $settings['address_component'] : FALSE,
'#require' => TRUE,
);
$form['operator'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#options' => commerce_order_address_comparison_operator_options_list(),
'#title' => t('Operator'),
'#title_display' => 'invisible',
'#default_value' => !empty($settings['operator']) ? $settings['operator'] : FALSE,
'#require' => TRUE,
);
$form['value'] = array(
'#type' => 'textarea',
'#title' => t('Value'),
'#title_display' => 'invisible',
'#rows' => 3,
'#default_value' => !empty($settings['value']) ? $settings['value'] : FALSE,
'#require' => TRUE,
'#suffix' => '<div class="condition-instructions">' . t('The discount is active if the order address component selected matches the entered value. For the entered value bear in mind that addresses using select lists for various components may use a value different from the option you select. For example, countries are selected by name, but the value is the two letter abbreviation. For comparisons with multiple possible values, place separate values on new lines.') . '</div>',
);
return $form;
}