You are here

public function WorkflowManager::getFields in Workflow 8

Utility function to return an array of workflow fields.

Parameters

string $entity_type_id: The content entity type to which the workflow fields are attached.

Return value

array An array of workflow field map definitions, keyed by field name. Each value is an array with two entries:

  • type: The field type.
  • bundles: The bundles in which the field appears, as array with entity types as keys and the array of bundle names as values.

Overrides WorkflowManagerInterface::getFields

See also

\Drupal\Core\Entity\EntityManagerInterface::getFieldMap()

\Drupal\comment\CommentManagerInterface::getFields()

File

src/Entity/WorkflowManager.php, line 370

Class

WorkflowManager
Manages entity type plugin definitions.

Namespace

Drupal\workflow\Entity

Code

public function getFields($entity_type_id) {
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity_type_id);
  if (!$entity_type
    ->entityClassImplements(FieldableEntityInterface::class)) {
    return [];
  }
  $map = $this->entityFieldManager
    ->getFieldMapByFieldType('workflow');
  return isset($map[$entity_type_id]) ? $map[$entity_type_id] : [];
}