You are here

public function LicenseTypeBase::setConfigurationValuesOnLicense in Commerce License 8.2

Copy configuration values to a license entity.

This does not save the license; it is the caller's responsibility to do so.

This should only be called on a plugin which has configuration. It should not be called on a plugin obtained from LicenseInterface::getTypePlugin(), as that has no configuration.

Parameters

\Drupal\commerce_license\Entity\LicenseInterface $license: The license entity.

Overrides LicenseTypeInterface::setConfigurationValuesOnLicense

File

src/Plugin/Commerce/LicenseType/LicenseTypeBase.php, line 91

Class

LicenseTypeBase
Provides the base license type class.

Namespace

Drupal\commerce_license\Plugin\Commerce\LicenseType

Code

public function setConfigurationValuesOnLicense(LicenseInterface $license) {

  // By default, assume that a key in the configuration array corresponds to
  // a field provided to the license type as an entity trait field in
  // buildFieldDefinitions().
  foreach ($this->configuration as $key => $value) {
    $license->{$key} = $value;
  }
}