You are here

public function EmailEventManager::processDefinition in Commerce Email 8

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/EmailEventManager.php, line 52

Class

EmailEventManager
Manages discovery and instantiation of condition plugins.

Namespace

Drupal\commerce_email

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);
  foreach ([
    'id',
    'label',
    'entity_type',
  ] as $required_property) {
    if (empty($definition[$required_property])) {
      throw new PluginException(sprintf('The condition "%s" must define the "%s" property.', $plugin_id, $required_property));
    }
  }
  $entity_type_id = $definition['entity_type'];
  if (!$this->entityTypeManager
    ->getDefinition($entity_type_id)) {
    throw new PluginException(sprintf('The condition "%s" must specify a valid entity type, "%s" given.', $plugin_id, $entity_type_id));
  }
}