You are here

public function WorkflowGroupManager::getDefinitionsByEntityType in State Machine 8

Gets the definitions filtered by entity type.

Parameters

string $entity_type_id: The entity type ID.

Return value

array The definitions.

Overrides WorkflowGroupManagerInterface::getDefinitionsByEntityType

File

src/WorkflowGroupManager.php, line 83

Class

WorkflowGroupManager
Manages discovery and instantiation of workflow_group plugins.

Namespace

Drupal\state_machine

Code

public function getDefinitionsByEntityType($entity_type_id = NULL) {
  $definitions = $this
    ->getDefinitions();
  if ($entity_type_id) {
    $definitions = array_filter($definitions, function ($definition) use ($entity_type_id) {
      return $definition['entity_type'] == $entity_type_id;
    });
  }
  return $definitions;
}