function commerce_product_bundle_field_formatter_settings_form in Commerce Product Bundle 7.2
Same name and namespace in other branches
- 7 commerce_product_bundle.module \commerce_product_bundle_field_formatter_settings_form()
Implements hook_field_formatter_settings_form().
File
- ./
commerce_product_bundle.module, line 38 - Allows the bundling of products in Drupal Commerce.
Code
function commerce_product_bundle_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'] + commerce_product_bundle_field_formatter_default_settings();
$element = array();
if ($display['type'] == 'commerce_bundle_product_add_to_cart_form') {
$element['show_quantity'] = array(
'#type' => 'checkbox',
'#title' => t('Display a textfield quantity widget on the add to cart form for this bundle.'),
'#default_value' => $settings['show_quantity'],
);
$element['default_quantity'] = array(
'#type' => 'textfield',
'#title' => t('Default quantity'),
'#default_value' => $settings['default_quantity'] <= 0 ? 1 : $settings['default_quantity'],
'#element_validate' => array(
'commerce_cart_field_formatter_settings_form_quantity_validate',
),
'#size' => 16,
);
$element['show_fieldset'] = array(
'#type' => 'checkbox',
'#title' => t('Display the options in a fieldset.'),
'#default_value' => $settings['show_fieldset'],
);
}
return $element;
}