diff --git a/ext/tag_list/config.php b/ext/tag_list/config.php index dc4560d6..0af8f3e1 100644 --- a/ext/tag_list/config.php +++ b/ext/tag_list/config.php @@ -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"; diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 0a60c021..610c3aa5 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -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"); } } diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index 6f771871..0de9cc29 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -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)); }