Option to display post tags and related tags at the same time
This commit is contained in:
parent
4aabb77a4f
commit
32cdb95d00
@ -14,11 +14,13 @@ class TagListConfig
|
|||||||
public const OMIT_TAGS = "tag_list_omit_tags";
|
public const OMIT_TAGS = "tag_list_omit_tags";
|
||||||
|
|
||||||
public const TYPE_RELATED = "related";
|
public const TYPE_RELATED = "related";
|
||||||
public const TYPE_TAGS= "tags";
|
public const TYPE_TAGS = "tags";
|
||||||
|
public const TYPE_BOTH = "both";
|
||||||
|
|
||||||
public const TYPE_CHOICES = [
|
public const TYPE_CHOICES = [
|
||||||
"Post's tags only" => TagListConfig::TYPE_TAGS,
|
"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";
|
public const SORT_ALPHABETICAL = "alphabetical";
|
||||||
|
@ -81,15 +81,17 @@ class TagList extends Extension
|
|||||||
{
|
{
|
||||||
global $config, $page;
|
global $config, $page;
|
||||||
if ($config->get_int(TagListConfig::LENGTH) > 0) {
|
if ($config->get_int(TagListConfig::LENGTH) > 0) {
|
||||||
if ($config->get_string(TagListConfig::IMAGE_TYPE) == TagListConfig::TYPE_RELATED) {
|
$type = $config->get_string(TagListConfig::IMAGE_TYPE);
|
||||||
$this->add_related_block($page, $event->image);
|
if ($type == TagListConfig::TYPE_TAGS || $type == TagListConfig::TYPE_BOTH) {
|
||||||
} else {
|
|
||||||
if (class_exists("TagCategories") and $config->get_bool(TagCategoriesConfig::SPLIT_ON_VIEW)) {
|
if (class_exists("TagCategories") and $config->get_bool(TagCategoriesConfig::SPLIT_ON_VIEW)) {
|
||||||
$this->add_split_tags_block($page, $event->image);
|
$this->add_split_tags_block($page, $event->image);
|
||||||
} else {
|
} else {
|
||||||
$this->add_tags_block($page, $event->image);
|
$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);
|
$tags = $database->get_all($query, $args);
|
||||||
if (count($tags) > 0) {
|
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);
|
$tags = $database->get_all($query, $args);
|
||||||
if (count($tags) > 0) {
|
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 ($main_html != null) {
|
||||||
if ($config->get_string(TagListConfig::IMAGE_TYPE)==TagListConfig::TYPE_TAGS) {
|
$page->add_block(new Block("Tags", $main_html, "left", 10));
|
||||||
$page->add_block(new Block("Tags", $main_html, "left", 10));
|
|
||||||
} else {
|
|
||||||
$page->add_block(new Block("Related 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;
|
global $config;
|
||||||
|
|
||||||
@ -173,11 +169,7 @@ class TagListTheme extends Themelet
|
|||||||
$config->get_string(TagListConfig::RELATED_SORT)
|
$config->get_string(TagListConfig::RELATED_SORT)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($config->get_string(TagListConfig::IMAGE_TYPE)==TagListConfig::TYPE_TAGS) {
|
$page->add_block(new Block($block_name, $main_html, "left", 10));
|
||||||
$page->add_block(new Block("Tags", $main_html, "left", 10));
|
|
||||||
} else {
|
|
||||||
$page->add_block(new Block("Related Tags", $main_html, "left", 10));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user