You are here

function uc_attribute_form_uc_product_settings_form_alter in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_attribute/uc_attribute.module \uc_attribute_form_uc_product_settings_form_alter()

Implements hook_form_FORM_ID_alter() for uc_product_settings_form().

File

uc_attribute/uc_attribute.module, line 80
Ubercart Attribute module.

Code

function uc_attribute_form_uc_product_settings_form_alter(&$form, FormStateInterface $form_state) {
  $form['attributes'] = [
    '#type' => 'details',
    '#title' => 'Attribute settings',
    '#group' => 'product-settings',
    '#weight' => -3,
  ];
  $form['attributes']['uc_attribute_option_price_format'] = [
    '#type' => 'radios',
    '#title' => t('Option price format'),
    '#default_value' => \Drupal::config('uc_attribute.settings')
      ->get('option_price_format'),
    '#options' => [
      'none' => t('Do not display'),
      'adjustment' => t('Display price adjustment'),
      'total' => t('Display total price'),
    ],
    '#description' => t('Determines how price variations are displayed to the customer. Prices may be displayed directly next to each attribute option in the attribute selection form either as a total price for the product with that option or as an adjustment (+ or -) showing how that option affects the product base price. Note that the price will always be displayed as an adjustment for attributes that can have multiple options (using checkboxes).'),
  ];
  $form['#submit'][] = 'uc_attribute_uc_product_settings_form_submit';
}