Created
May 28, 2020 12:27
-
-
Save cgi-caesar/ff6bef3353a4451413cb39a6fe136d72 to your computer and use it in GitHub Desktop.
aMember (site.php): Add images for video within Active Resources widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$di = Am_Di::getInstance(); | |
if ($di->auth->getUser() | |
&& ($videos = $di->resourceAccessTable->getAllowedResources($di->auth->getUser(), ResourceAccess::VIDEO)) | |
) { | |
$di->view->headStyle() | |
->appendStyle("#member-main-resources li {display: block;}"); | |
foreach ($videos as $v) { | |
if ($v->poster_id) { | |
$file = $di->plugins_storage->getFile($v->poster_id); | |
$img = $file->getUrl(100, false); | |
$di->view->headStyle()->appendStyle(<<<CUT | |
#member-main-resources li#resource-link-video-{$v->pk()}-wrapper { | |
background: url('{$img}') left center no-repeat; | |
background-size: 50px; | |
padding-left: 60px; | |
min-height: 50px; | |
vertical-align: middle; | |
} | |
CUT | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment