You are here

public function FedEx::validateConfigurationForm in Commerce FedEx 8

Form validation 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::validateConfigurationForm

File

src/Plugin/Commerce/ShippingMethod/FedEx.php, line 370

Class

FedEx
Provides the FedEx shipping method.

Namespace

Drupal\commerce_fedex\Plugin\Commerce\ShippingMethod

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);
  foreach ($this->fedExServiceManager
    ->getDefinitions() as $plugin_id => $definition) {
    if (!empty($form[$plugin_id])) {

      /** @var \Drupal\commerce_fedex\Plugin\Commerce\FedEx\FedExPluginInterface $plugin */
      $plugin = $this->plugins
        ->get($plugin_id);
      $plugin
        ->validateConfigurationForm($form[$plugin_id], SubformState::createForSubform($form[$plugin_id], $form_state
        ->getCompleteForm(), $form_state));
    }
  }
}