Merge pull request #810 from LaureeGrd/post-tags
Option to display post tags and related tags at the same time
This commit is contained in:
commit
6f2febde92
3 changed files with 14 additions and 18 deletions
|
@ -14,11 +14,13 @@ class TagListConfig
|
|||
public const OMIT_TAGS = "tag_list_omit_tags";
|
||||
|
||||
public const TYPE_RELATED = "related";
|
||||
public const TYPE_TAGS= "tags";
|
||||
public const TYPE_TAGS = "tags";
|
||||
public const TYPE_BOTH = "both";
|
||||
|
||||
public const TYPE_CHOICES = [
|
||||
"Post's tags only" => TagListConfig::TYPE_TAGS,
|
||||
"Show related" => TagListConfig::TYPE_RELATED
|
||||
"Related tags only" => TagListConfig::TYPE_RELATED,
|
||||
"Both" => TagListConfig::TYPE_BOTH
|
||||
];
|
||||
|
||||
public const SORT_ALPHABETICAL = "alphabetical";
|
||||
|
|
|
@ -81,15 +81,17 @@ class TagList extends Extension
|
|||
{
|
||||
global $config, $page;
|
||||
if ($config->get_int(TagListConfig::LENGTH) > 0) {
|
||||
if ($config->get_string(TagListConfig::IMAGE_TYPE) == TagListConfig::TYPE_RELATED) {
|
||||
$this->add_related_block($page, $event->image);
|
||||
} else {
|
||||
$type = $config->get_string(TagListConfig::IMAGE_TYPE);
|
||||
if ($type == TagListConfig::TYPE_TAGS || $type == TagListConfig::TYPE_BOTH) {
|
||||
if (class_exists("TagCategories") and $config->get_bool(TagCategoriesConfig::SPLIT_ON_VIEW)) {
|
||||
$this->add_split_tags_block($page, $event->image);
|
||||
} else {
|
||||
$this->add_tags_block($page, $event->image);
|
||||
}
|
||||
}
|
||||
if ($type == TagListConfig::TYPE_RELATED || $type == TagListConfig::TYPE_BOTH) {
|
||||
$this->add_related_block($page, $event->image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,7 +443,7 @@ class TagList extends Extension
|
|||
|
||||
$tags = $database->get_all($query, $args);
|
||||
if (count($tags) > 0) {
|
||||
$this->theme->display_related_block($page, $tags);
|
||||
$this->theme->display_related_block($page, $tags, "Related Tags");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -479,7 +481,7 @@ class TagList extends Extension
|
|||
|
||||
$tags = $database->get_all($query, $args);
|
||||
if (count($tags) > 0) {
|
||||
$this->theme->display_related_block($page, $tags);
|
||||
$this->theme->display_related_block($page, $tags, "Tags");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,11 +118,7 @@ class TagListTheme extends Themelet
|
|||
}
|
||||
|
||||
if ($main_html != null) {
|
||||
if ($config->get_string(TagListConfig::IMAGE_TYPE)==TagListConfig::TYPE_TAGS) {
|
||||
$page->add_block(new Block("Tags", $main_html, "left", 10));
|
||||
} else {
|
||||
$page->add_block(new Block("Related Tags", $main_html, "left", 10));
|
||||
}
|
||||
$page->add_block(new Block("Tags", $main_html, "left", 10));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +160,7 @@ class TagListTheme extends Themelet
|
|||
* ...
|
||||
* )
|
||||
*/
|
||||
public function display_related_block(Page $page, $tag_infos)
|
||||
public function display_related_block(Page $page, $tag_infos, $block_name)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -173,11 +169,7 @@ class TagListTheme extends Themelet
|
|||
$config->get_string(TagListConfig::RELATED_SORT)
|
||||
);
|
||||
|
||||
if ($config->get_string(TagListConfig::IMAGE_TYPE)==TagListConfig::TYPE_TAGS) {
|
||||
$page->add_block(new Block("Tags", $main_html, "left", 10));
|
||||
} else {
|
||||
$page->add_block(new Block("Related Tags", $main_html, "left", 10));
|
||||
}
|
||||
$page->add_block(new Block($block_name, $main_html, "left", 10));
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue