You are here

public function FedEx::updatePlugins in Commerce FedEx 8

Updates the configuration array with currently discovered plugins.

Return value

$this

File

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

Class

FedEx
Provides the FedEx shipping method.

Namespace

Drupal\commerce_fedex\Plugin\Commerce\ShippingMethod

Code

public function updatePlugins() {
  $definitions = $this->fedExServiceManager
    ->getDefinitions();
  $this->configuration['plugins'] = array_intersect_key($this->configuration['plugins'], $definitions);
  foreach ($definitions as $plugin_id => $definition) {
    if (empty($this->configuration['plugins'][$plugin_id])) {
      $this->configuration['plugins'][$plugin_id] = [
        'plugin_id' => $plugin_id,
        'configuration' => [
          'id' => $plugin_id,
        ],
      ];
    }
  }
  return $this;
}