You are here

public function KanbanService::getEntityIdsFromContentModerationEntities in Content Planner 8

Gets the entity IDs from Content Moderation entities.

Parameters

string $workflow: The workflow id.

array $filters: An array with the filters.

array $entities: An array with the entities.

Return value

array Returns an array with the entity ids.

File

modules/content_kanban/src/KanbanService.php, line 260

Class

KanbanService
Class KanbanService.

Namespace

Drupal\content_kanban

Code

public function getEntityIdsFromContentModerationEntities($workflow, array $filters = [], array $entities = []) {
  $entityIds = [];
  if ($content_moderation_states = $this
    ->getEntityContentModerationEntities($workflow, $filters, $entities)) {
    foreach ($content_moderation_states as $content_moderation_state) {

      // Get property.
      $content_entity_id_property = $content_moderation_state->content_entity_id;

      // Get value.
      $content_entity_id_value = $content_entity_id_property
        ->getValue();
      $entity_type_id_value = $content_moderation_state
        ->get('content_entity_type_id')
        ->getValue();

      // Get the entity type id.
      $entity_type_id = $entity_type_id_value[0]['value'];

      // Build the ids array with entity type as key.
      $entityIds[$entity_type_id][] = $content_entity_id_value[0]['value'];
    }
  }
  return $entityIds;
}