public function FedEx::submitConfigurationForm in Commerce FedEx 8
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 ShippingMethodBase::submitConfigurationForm
File
- src/
Plugin/ Commerce/ ShippingMethod/ FedEx.php, line 386
Class
- FedEx
- Provides the FedEx shipping method.
Namespace
Drupal\commerce_fedex\Plugin\Commerce\ShippingMethodCode
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
if (!$form_state
->getErrors()) {
$values = $form_state
->getValue($form['#parents']);
$this->configuration['api_information']['api_key'] = $values['api_information']['api_key'];
if (!empty($values['api_information']['api_password'])) {
$this->configuration['api_information']['api_password'] = $values['api_information']['api_password'];
}
$this->configuration['api_information']['account_number'] = $values['api_information']['account_number'];
$this->configuration['api_information']['meter_number'] = $values['api_information']['meter_number'];
$this->configuration['api_information']['mode'] = $values['api_information']['mode'];
$this->configuration['options']['packaging'] = $values['options']['packaging'];
$this->configuration['options']['rate_request_type'] = $values['options']['rate_request_type'];
$this->configuration['options']['dropoff'] = $values['options']['dropoff'];
$this->configuration['options']['insurance'] = $values['options']['insurance'];
$this->configuration['options']['rate_multiplier'] = $values['options']['rate_multiplier'];
$this->configuration['options']['round'] = $values['options']['round'];
$this->configuration['options']['log'] = $values['options']['log'];
unset($this->configuration['plugins']);
foreach ($this->fedExServiceManager
->getDefinitions() as $plugin_id => $definition) {
/** @var \Drupal\commerce_fedex\Plugin\Commerce\FedEx\FedExPluginInterface $plugin */
$plugin = $this->plugins
->get($plugin_id);
if (!empty($form[$plugin_id])) {
$plugin
->submitConfigurationForm($form[$plugin_id], SubformState::createForSubform($form[$plugin_id], $form_state
->getCompleteForm(), $form_state));
}
$this->configuration['plugins'][$plugin_id]['configuration'] = $plugin
->getConfiguration();
}
}
parent::submitConfigurationForm($form, $form_state);
}