findMediaDisplayInfo() 공개 메소드

Finds all the information needed to generate an url to the media and to display the media. The method finds the information for all medias with given ids.
public findMediaDisplayInfo ( $ids, $locale ) : array
$ids array The ids of the medias for which the info should be found
$locale string The locale in which the display info should be loaded
리턴 array
예제 #1
0
파일: MediaTag.php 프로젝트: sulu/sulu
 /**
  * Return assets by id for given attributes.
  *
  * @param array $attributesByTag
  * @param string $locale
  *
  * @return array
  */
 private function preloadMedias($attributesByTag, $locale)
 {
     $ids = array_unique(array_values(array_map(function ($attributes) {
         return $attributes['id'];
     }, $attributesByTag)));
     $medias = $this->mediaRepository->findMediaDisplayInfo($ids, $locale);
     $result = [];
     foreach ($medias as $media) {
         $media['url'] = $this->mediaManager->getUrl($media['id'], $media['name'], $media['version']);
         $result[$media['id']] = $media;
     }
     return $result;
 }