public function Acquiadam::layoutMediaEntity in Media: Acquia DAM 8
Format display of one asset in media browser.
Return value
string Element HTML markup.
1 call to Acquiadam::layoutMediaEntity()
- Acquiadam::getForm in src/
Plugin/ EntityBrowser/ Widget/ Acquiadam.php
File
- src/
Plugin/ EntityBrowser/ Widget/ Acquiadam.php, line 593
Class
- Acquiadam
- Uses a view to provide entity listing in a browser's widget.
Namespace
Drupal\media_acquiadam\Plugin\EntityBrowser\WidgetCode
public function layoutMediaEntity(Asset $acquiadamAsset) {
$modulePath = $this->moduleHandler
->getModule('media_acquiadam')
->getPath();
$assetName = $acquiadamAsset->status !== 'active' ? "{$acquiadamAsset->name} ({$acquiadamAsset->status})" : $acquiadamAsset->name;
if (!empty($acquiadamAsset->thumbnailurls)) {
$thumbnail = '<div class="acquiadam-asset-thumb"><img src="' . $acquiadamAsset->thumbnailurls[2]->url . '" alt="' . $assetName . '" /></div>';
}
else {
$thumbnail = '<span class="acquiadam-browser-empty">No preview available.</span>';
}
$element = '<div class="acquiadam-asset-checkbox">' . $thumbnail . '<div class="acquiadam-asset-details"><a href="/acquiadam/asset/' . $acquiadamAsset->id . '" class="use-ajax" data-dialog-type="modal"><img src="/' . $modulePath . '/img/ext-link.png" alt="Folder link" class="acquiadam-asset-browser-icon" /></a><p class="acquiadam-asset-filename">' . $assetName . '</p></div></div>';
return $element;
}