Skip to content

Commit

Permalink
Merge branch 'release/1.3.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Apr 16, 2024
2 parents fc1c721 + 547cba8 commit 24ecd56
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.3.6
## 04/16/2024

1. [](#new)
* Specify the page from which to get the child tags [#39](https://github.com/getgrav/grav-plugin-taxonomylist/issues/39)

# v1.3.5
## 12/02/2020

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ You can also include pass an optional parameter that will show taxonomy for chil
{% include 'partials/taxonomylist.html.twig' with {base_url: my_url, taxonomy: 'tag', children_only: true} %}
```

When using `children_only`, another optional parameter (`of_page`) may be used to specify the page to use:

```twig
{% include 'partials/taxonomylist.html.twig' with {base_url: my_url, taxonomy: 'tag', children_only: true, of_page: page.parent} %}
```


> NOTE: If you want to see this plugin in action, have a look at our [Blog Site Skeleton](https://github.com/getgrav/grav-skeleton-blog-site/archive/master.zip)

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Taxonomy List
type: plugin
slug: taxonomylist
version: 1.3.5
version: 1.3.6
description: "With the **TaxonomyList plugin** you can easily create list of **taxonomy** items such as **tags**, **categories**, etc."
icon: tag
author:
Expand Down
7 changes: 5 additions & 2 deletions classes/taxonomylist.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ public function get()
*
* @return array
*/
public function getChildPagesTags()
public function getChildPagesTags(PageInterface $current = null)
{
/** @var PageInterface $current */
$current = Grav::instance()['page'];
if (null === $current) {
$current = Grav::instance()['page'];
}

$taxonomies = [];
foreach ($current->children()->published() as $child) {
if (!$child->isPage()) {
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/taxonomylist.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set taxlist = children_only is defined ? taxonomylist.getChildPagesTags() : taxonomylist.get() %}
{% set taxlist = children_only is defined ? taxonomylist.getChildPagesTags(of_page) : taxonomylist.get() %}

{% if taxlist %}
<span class="tags">
Expand Down

0 comments on commit 24ecd56

Please sign in to comment.