EditTag: introduce featured thumbnail manager
This commit is contained in:
42
templates/FeaturedThumbnailManager.php
Normal file
42
templates/FeaturedThumbnailManager.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
* FeaturedThumbnailManager.php
|
||||
* Contains the featured thumbnail manager template.
|
||||
*
|
||||
* Kabuki CMS (C) 2013-2021, Aaron van Geffen
|
||||
*****************************************************************************/
|
||||
|
||||
class FeaturedThumbnailManager extends SubTemplate
|
||||
{
|
||||
private $assets;
|
||||
private $currentThumbnailId;
|
||||
|
||||
public function __construct(AssetIterator $assets, $currentThumbnailId)
|
||||
{
|
||||
$this->assets = $assets;
|
||||
$this->currentThumbnailId = $currentThumbnailId;
|
||||
}
|
||||
|
||||
protected function html_content()
|
||||
{
|
||||
echo '
|
||||
<h2>Select thumbnail</h2>
|
||||
<ul id="featuredThumbnail">';
|
||||
|
||||
while ($asset = $this->assets->next())
|
||||
{
|
||||
$image = $asset->getImage();
|
||||
echo '
|
||||
<li>
|
||||
<input class="form-check-input" type="radio" name="featuredThumbnail" value="', $image->getId(), '"',
|
||||
$this->currentThumbnailId == $image->getId() ? ' checked' : '', '>
|
||||
<img src="', $image->getThumbnailUrl(150, 100, 'top'), '" alt="" title="', $image->getTitle(), '" onclick="this.parentNode.children[0].checked = true">
|
||||
</li>';
|
||||
}
|
||||
|
||||
$this->assets->clean();
|
||||
|
||||
echo '
|
||||
</ul>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user