You are here

function media_acquiadam_get_active_media_ids in Media: Acquia DAM 8

Returns the list of all active media entity ids.

Return value

array The list of media entity ids.

2 calls to media_acquiadam_get_active_media_ids()
AcquiadamConfig::getActiveMediaIds in src/Form/AcquiadamConfig.php
Wrapper for media_acquiadam_get_active_media_ids().
media_acquiadam_refresh_asset_sync_queue in ./media_acquiadam.module
Adds media items to the asset sync queue for later processing.

File

./media_acquiadam.module, line 315
Integrates Drupal with Acquia DAM.

Code

function media_acquiadam_get_active_media_ids() : array {
  $asset_id_fields = media_acquiadam_get_bundle_asset_id_fields();
  if (empty($asset_id_fields)) {
    return [];
  }
  $media_ids = [];
  foreach ($asset_id_fields as $bundle => $field) {
    $media_id_query = Drupal::entityQuery('media')
      ->condition('bundle', $bundle);
    $media_ids = array_merge($media_ids, $media_id_query
      ->execute());
  }
  return $media_ids;
}