getMeta() public method

Get meta.
public getMeta ( ) : FileVersionMeta[]
return FileVersionMeta[]
Example #1
0
 /**
  * @param int         $mediaId
  * @param FileVersion $fileVersion
  * @param string      $locale
  *
  * @return array
  */
 protected function getPreviewsFromFileVersion($mediaId, $fileVersion, $locale)
 {
     $title = '';
     /*
      * @var FileVersionMeta
      */
     foreach ($fileVersion->getMeta() as $key => $meta) {
         if ($meta->getLocale() == $locale) {
             $title = $meta->getTitle();
             break;
         } elseif ($key == 0) {
             // fallback title
             $title = $meta->getTitle();
         }
     }
     $mediaFormats = $this->formatManager->getFormats($mediaId, $fileVersion->getName(), $fileVersion->getStorageOptions(), $fileVersion->getVersion(), $fileVersion->getMimeType());
     foreach ($mediaFormats as $formatName => $formatUrl) {
         if ($formatName == $this->collectionPreviewFormat) {
             return ['url' => $formatUrl, 'title' => $title];
             break;
         }
     }
     return [];
 }