Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: Add depth support to TaggerGetTags #122

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* &outTpl string optional Name of a chunk that will be used for wrapping all tags. If no chunk is given, tags will be rendered without a wrapper
* &separator string optional String separator, that will be used for separating Tags
* &limit int optional Limit number of returned tag Tags
* &depth int optional Depth to search for child resources from each parent
* &offset int optional Offset the output by this number of Tags
* &totalPh string optional Placeholder to output the total number of Tags regardless of &limit and &offset
* &target int optional An ID of a resource that will be used for generating URI for a Tag. If no ID is given, current Resource ID will be used
Expand Down Expand Up @@ -58,6 +59,7 @@
$wrapIfEmpty = $modx->getOption('wrapIfEmpty', $scriptProperties, 1);
$separator = $modx->getOption('separator', $scriptProperties, '');
$limit = intval($modx->getOption('limit', $scriptProperties, 0));
$depth = intval($modx->getOption('depth', $scriptProperties, 10));
$offset = intval($modx->getOption('offset', $scriptProperties, 0));
$totalPh = $modx->getOption('totalPh', $scriptProperties, 'tags_total');

Expand Down Expand Up @@ -87,9 +89,9 @@
$c->leftJoin('modResource', 'Resource', array('Resources.resource = Resource.id'));

if (!empty($parents)) {
$c->where(array(
'Resource.parent:IN' => $parents,
));
if (!empty($parents)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like duplicit condition:

if (!empty($parents)) {
if (!empty($parents)) {

$resources = array_merge($parents, $modx->getChildIds(implode(',', $parents),$depth),$resources);
}
}

if (!empty($contexts)) {
Expand Down