function commerce_product_has_specified_terms_configure in Commerce Discount 7
Configuration callback for commerce_product_has_specified_terms on product.
Parameters
array $settings: Values for the form element.
Return value
array Return a form element.
1 string reference to 'commerce_product_has_specified_terms_configure'
File
- ./
commerce_discount.inline_conditions.inc, line 634 - Provides Inline Conditions integration for the Commerce Discount module.
Code
function commerce_product_has_specified_terms_configure($settings) {
$form = array();
// Ensure we've default settings set.
$settings += array(
'terms' => array(),
);
$default_value = '';
foreach ($settings['terms'] as $delta => $term) {
$default_value .= taxonomy_term_load($term['target_id'])->name . ' (' . $term['target_id'] . ')';
if ($term != end($settings['terms'])) {
$default_value .= ', ';
}
}
$form['terms'] = array(
'#type' => 'textfield',
'#title' => t('Terms'),
'#title_display' => 'invisible',
'#required' => TRUE,
'#maxlength' => 4096,
'#default_value' => $default_value,
'#autocomplete_path' => 'inline_conditions/autocomplete/taxonomy_term/1/0',
'#element_validate' => array(
'_inline_conditions_autocomplete_validate',
),
'#suffix' => '<div class="condition-instructions">' . t('The discount is active if the product has the selected term(s).') . '</div>',
);
return $form;
}