public function PercentageOffTrait::buildConfigurationForm in Commerce Core 8.2
File
- modules/
promotion/ src/ Plugin/ Commerce/ PromotionOffer/ PercentageOffTrait.php, line 38
Class
- PercentageOffTrait
- Provides common configuration for percentage off offers.
Namespace
Drupal\commerce_promotion\Plugin\Commerce\PromotionOfferCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['percentage'] = [
'#type' => 'commerce_number',
'#title' => $this
->t('Percentage off'),
'#default_value' => Calculator::multiply($this
->getPercentage(), '100'),
'#maxlength' => 255,
'#min' => 0,
'#max' => 100,
'#size' => 4,
'#field_suffix' => $this
->t('%'),
'#required' => TRUE,
'#weight' => -1,
];
return $form;
}