You are here

public function ShippingMethodBase::submitConfigurationForm in Commerce Shipping 8.2

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 PluginFormInterface::submitConfigurationForm

1 call to ShippingMethodBase::submitConfigurationForm()
FlatRate::submitConfigurationForm in src/Plugin/Commerce/ShippingMethod/FlatRate.php
Form submission handler.
1 method overrides ShippingMethodBase::submitConfigurationForm()
FlatRate::submitConfigurationForm in src/Plugin/Commerce/ShippingMethod/FlatRate.php
Form submission handler.

File

src/Plugin/Commerce/ShippingMethod/ShippingMethodBase.php, line 231

Class

ShippingMethodBase
Provides the base class for shipping methods.

Namespace

Drupal\commerce_shipping\Plugin\Commerce\ShippingMethod

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  if (!$form_state
    ->getErrors()) {
    $values = $form_state
      ->getValue($form['#parents']);
    if (!empty($values['services'])) {
      $values['services'] = array_filter($values['services']);
      $this->configuration['default_package_type'] = $values['default_package_type'];
      $this->configuration['services'] = array_keys($values['services']);
    }
    $this->configuration['workflow'] = $values['workflow'];
  }
}