public function getSubdefUrl(RecordInterface $record, $subdefName) { if ($record instanceof ElasticsearchRecord) { $subdefs = $record->getSubdefs(); if (isset($subdefs[$subdefName])) { $thumbnail = $subdefs[$subdefName]; if (null !== ($path = $thumbnail['path'])) { if (is_string($path) && '' !== $path) { return $this->app['phraseanet.static-file']->getUrl($path); } } } } elseif ($record instanceof \record_adapter) { if (null !== ($thumbnail = $record->get_subdef($subdefName))) { if ('' !== ($path = $thumbnail->get_pathfile())) { return $this->app['phraseanet.static-file']->getUrl($path); } } } $path = sprintf('/assets/common/images/icons/substitution/%s.png', str_replace('/', '_', $record->getMimeType())); return $path; }