function uc_product_settings_form in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_product/uc_product.module \uc_product_settings_form()
- 6.2 uc_product/uc_product.admin.inc \uc_product_settings_form()
Form to change product settings.
1 string reference to 'uc_product_settings_form'
- uc_product_menu in uc_product/
uc_product.module - Implements hook_menu().
File
- uc_product/
uc_product.admin.inc, line 48 - Product administration menu items.
Code
function uc_product_settings_form($form, &$form_state) {
// Put fieldsets into vertical tabs
$form['product-settings'] = array(
'#type' => 'vertical_tabs',
);
$form['product'] = array(
'#type' => 'fieldset',
'#title' => t('Product settings'),
'#group' => 'product-settings',
'#weight' => -10,
);
// Loop through all the integrated image widgets and build an options array.
$options = array();
foreach (module_invoke_all('uc_image_widget') as $key => $widget) {
$options[$key] = check_plain($widget['name']);
}
if (empty($options)) {
$options[NULL] = t('No image widgets installed.');
}
else {
// If we have widgets installed, add option to not use any of them
$options['none'] = t("Don't use any image widgets.");
}
$form['product']['uc_product_image_widget'] = array(
'#type' => 'radios',
'#title' => t('Product image widget'),
'#description' => t('The selected widget will be used to display a zoomed version of product images when they are clicked.'),
'#options' => $options,
'#default_value' => variable_get('uc_product_image_widget', NULL),
);
if (module_exists('uc_cart')) {
$form['product']['uc_product_add_to_cart_qty'] = array(
'#type' => 'checkbox',
'#title' => t('Display an optional quantity field in the <em>Add to Cart</em> form.'),
'#default_value' => variable_get('uc_product_add_to_cart_qty', FALSE),
);
$form['product']['uc_product_update_node_view'] = array(
'#type' => 'checkbox',
'#title' => t('Update product display based on customer selections'),
'#default_value' => variable_get('uc_product_update_node_view', FALSE),
'#description' => t('Check this box to dynamically update the display of product information such as display-price or weight based on customer input on the add-to-cart form (e.g. selecting a particular attribute option).'),
);
}
foreach (module_invoke_all('uc_product_feature') as $feature) {
if (isset($feature['settings']) && function_exists($feature['settings'])) {
$form[$feature['id']] = array(
'#type' => 'fieldset',
'#title' => t('@feature settings', array(
'@feature' => $feature['title'],
)),
'#group' => 'product-settings',
);
$form[$feature['id']] += $feature['settings'](array(), $form_state);
if (function_exists($feature['settings'] . '_validate')) {
$form['#validate'][] = $feature['settings'] . '_validate';
}
if (function_exists($feature['settings'] . '_submit')) {
$form['#submit'][] = $feature['settings'] . '_submit';
}
}
}
return system_settings_form($form);
}