You are here

public function ShipmentWeightMultipleConds::submitConfigurationForm in Commerce Shipping Weight Tariff 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Commerce/Condition/ShipmentWeightMultipleConds.php \Drupal\commerce_shipping_weight_tariff\Plugin\Commerce\Condition\ShipmentWeightMultipleConds::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides ConditionBase::submitConfigurationForm

File

src/Plugin/Commerce/Condition/ShipmentWeightMultipleConds.php, line 207

Class

ShipmentWeightMultipleConds
Provides the multiple weight condition for shipments.

Namespace

Drupal\commerce_shipping_weight_tariff\Plugin\Commerce\Condition

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);

  // Saving configuration values.
  $values = $form_state
    ->getValue($form['#parents']);
  for ($i = 1; $i <= 10; $i++) {
    $this->configuration['condition_' . $i]['enabled'] = $values['condition_' . $i]['enabled'];
    $this->configuration['condition_' . $i]['price'] = $values['condition_' . $i]['price'];
    $this->configuration['condition_' . $i]['operator'] = $values['condition_' . $i]['operator'];
    $this->configuration['condition_' . $i]['weight'] = $values['condition_' . $i]['weight'];
  }
}