You are here

public function LicenseTypeManager::processDefinition in Commerce License 8.2

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

Overrides DefaultPluginManager::processDefinition

File

src/LicenseTypeManager.php, line 47

Class

LicenseTypeManager
Manages discovery and instantiation of license type plugins.

Namespace

Drupal\commerce_license

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);
  foreach ([
    'id',
    'label',
  ] as $required_property) {
    if (empty($definition[$required_property])) {
      throw new PluginException(sprintf('The license type %s must define the %s property.', $plugin_id, $required_property));
    }
  }
}