Skip to content

Commit

Permalink
Added tags to gallery image templates
Browse files Browse the repository at this point in the history
  • Loading branch information
hschottm committed Mar 24, 2017
1 parent 9c8d1b7 commit 75f2580
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions elements/ContentGalleryTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function compile()
if ((strlen(\Input::get('tag')) && (!$this->tag_ignore)) || (strlen($this->tag_filter)))
{
$tagids = array();

$relatedlist = (strlen(\Input::get('related'))) ? preg_split("/,/", \Input::get('related')) : array();
$alltags = array_merge(array(\Input::get('tag')), $relatedlist);
$first = true;
Expand Down Expand Up @@ -84,7 +84,22 @@ public function compile()
}
parent::compile();
}


public static function addImageToTemplate($objTemplate, $arrItem, $intMaxWidth=null, $strLightboxId=null)
{
\Controller::addImageToTemplate($objTemplate, $arrItem, $intMaxWidth, $strLightboxId);
if (TL_MODE == 'FE')
{
$found = \TagModel::findByIdAndTable($arrItem['id'], 'tl_files');
$tags = array();
while ($found->next())
{
array_push($tags, $found->tag);
}
$objTemplate->tags = $tags;
}
}

protected function getFilterTags()
{
if (strlen($this->tag_filter))
Expand All @@ -105,5 +120,5 @@ protected function getFilterTags()
return array();
}
}

}

0 comments on commit 75f2580

Please sign in to comment.