You are here

public function WorkflowGroupManager::processDefinition in State Machine 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/WorkflowGroupManager.php, line 65

Class

WorkflowGroupManager
Manages discovery and instantiation of workflow_group plugins.

Namespace

Drupal\state_machine

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);
  if ($plugin_id == 'state_machine') {
    throw new PluginException('The "state_machine" workflow_group ID is reserved and must not be used.');
  }
  $definition['id'] = $plugin_id;
  foreach ([
    'label',
    'entity_type',
  ] as $required_property) {
    if (empty($definition[$required_property])) {
      throw new PluginException(sprintf('The workflow_group %s must define the %s property.', $plugin_id, $required_property));
    }
  }
}