public static function ContentEntitySourcePluginUi::getTranslatableEntities

Gets translatable entities of a given type.

Additionally you can specify entity property conditions, pager and limit.

Parameters

string $entity_type_id: Drupal entity type.

array $property_conditions: Entity properties. There is no value processing so caller must make sure the provided entity property exists for given entity type and its value is processed.

bool $pager: Flag to determine if pager will be used.

int $offset: Query range offset.

int $limit: Query range limit.

Return value

array ContentEntityInterface[] Array of translatable entities.

2 calls to ContentEntitySourcePluginUi::getTranslatableEntities()
ContentEntitySourcePluginUi::createContinuousJobItemsBatch in sources/content/src/ContentEntitySourcePluginUi.php
Creates continuous job items for entity.
ContentEntitySourcePluginUi::overviewForm in sources/content/src/ContentEntitySourcePluginUi.php
Builds the overview form for the source entities.

File

sources/content/src/ContentEntitySourcePluginUi.php, line 367

Class

ContentEntitySourcePluginUi
Content entity source plugin UI.

Namespace

Drupal\tmgmt_content

Code

public static function getTranslatableEntities($entity_type_id, $property_conditions = array(), $pager = FALSE, $offset = 0, $limit = 0) {
  $query = static::buildTranslatableEntitiesQuery($entity_type_id, $property_conditions);
  if ($query) {
    if ($pager) {
      $query = $query
        ->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender')
        ->limit(\Drupal::config('tmgmt.settings')
        ->get('source_list_limit'));
    }
    elseif ($limit) {
      $query
        ->range($offset, $limit);
    }
    else {
      $query
        ->range(0, \Drupal::config('tmgmt.settings')
        ->get('source_list_limit'));
    }
    $result = $query
      ->execute();
    $entity_ids = $result
      ->fetchCol();
    $entities = array();
    if (!empty($entity_ids)) {
      $entities = \Drupal::entityTypeManager()
        ->getStorage($entity_type_id)
        ->loadMultiple($entity_ids);
    }
    return $entities;
  }
  return array();
}