You are here

public function RouteSubscriber::listWorkflowFields in Workflow 8

Get all field of type workflow.

Return value

array Return all workflow fields.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

File

src/Routing/RouteSubscriber.php, line 120

Class

RouteSubscriber
Subscriber for Workflow routes.

Namespace

Drupal\workflow\Routing

Code

public function listWorkflowFields() {
  $fieldType = 'workflow';
  $fieldStorageConfigs = $this->entityTypeManager
    ->getStorage('field_storage_config')
    ->loadByProperties([
    'type' => $fieldType,
  ]);
  if (!$fieldStorageConfigs) {
    return [];
  }
  $availableItems = [];
  foreach ($fieldStorageConfigs as $fieldStorage) {
    $availableItems[] = $fieldStorage;
  }
  return $availableItems;
}