Skip to content

Commit f459837

Browse files
committed
Added toPlaceholder property to getTags snippet
* origin/pr/12: toPlaceholder Support
2 parents f96bfcc + cd2c6b8 commit f459837

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

Diff for: _build/data/transport.snippets.php

+8
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@
8181
'value' => '',
8282
'lexicon' => 'tagger:properties',
8383
),
84+
array(
85+
'name' => 'toPlaceholder',
86+
'desc' => 'tagger.gettags.toPlaceholder_desc',
87+
'type' => 'textfield',
88+
'options' => '',
89+
'value' => '',
90+
'lexicon' => 'tagger:properties',
91+
),
8492

8593
);
8694
$snippets[0]->setProperties($properties);

Diff for: core/components/tagger/docs/changelog.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Changelog for Tagger.
22

33
Tagger 1.1.0
44
==============
5+
- Added toPlaceholder property to getTags snippet
56
- Duplicate Tags also for children
67
- Improved gateway
78
- Added handler for onResourceDuplicate event, that copies Tags (only for the Resource, not for children)

Diff for: core/components/tagger/elements/snippets/taggergettags.snippet.php

+16-9
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
*
99
* PROPERTIES:
1010
*
11-
* &resources string optional Comma separated list of resources for which will be listed Tags
12-
* &groups string optional Comma separated list of Tagger Groups for which will be listed Tags
13-
* &rowTpl string optional Name of a chunk that will be used for each Tag. If no chunk is given, array with available placeholders will be rendered
14-
* &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
15-
* &separator string optional String separator, that will be used for separating Tags
16-
* &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
17-
* &showUnused int optional If 1 is set, Tags that are not assigned to any Resource will be included to the output as well
18-
* &contexts string optional If set, will display only tags for resources in given contexts. Contexts can be separated by a comma
11+
* &resources string optional Comma separated list of resources for which will be listed Tags
12+
* &groups string optional Comma separated list of Tagger Groups for which will be listed Tags
13+
* &rowTpl string optional Name of a chunk that will be used for each Tag. If no chunk is given, array with available placeholders will be rendered
14+
* &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
15+
* &separator string optional String separator, that will be used for separating Tags
16+
* &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
17+
* &showUnused int optional If 1 is set, Tags that are not assigned to any Resource will be included to the output as well
18+
* &contexts string optional If set, will display only tags for resources in given contexts. Contexts can be separated by a comma
19+
* &toPlaceholder string optional If set, output will return in placeholder with given name
1920
*
2021
* USAGE:
2122
*
@@ -41,6 +42,7 @@
4142
$resources = $tagger->explodeAndClean($resources);
4243
$groups = $tagger->explodeAndClean($groups);
4344
$contexts = $tagger->explodeAndClean($contexts);
45+
$toPlaceholder = $modx->getOption('toPlaceholder', $scriptProperties, '');
4446

4547
$c = $modx->newQuery('TaggerTag');
4648

@@ -109,4 +111,9 @@
109111
$out = $modx->getChunk($outTpl, array('tags' => $out));
110112
}
111113

112-
return $out;
114+
if (!empty($toPlaceholder)) {
115+
$modx->setPlaceholder($toPlaceholder, $out);
116+
return '';
117+
}
118+
119+
return $out;

Diff for: core/components/tagger/lexicon/en/properties.inc.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
$_lang['tagger.gettags.separator_desc'] = 'String separator, that will be used for separating Tags';
1818
$_lang['tagger.gettags.target_desc'] = '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';
1919
$_lang['tagger.gettags.showUnused_desc'] = 'If 1 is set, Tags that are not assigned to any Resource will be included to the output as well';
20-
$_lang['tagger.gettags.contexts_desc'] = 'If set, will display only tags for resources in given contexts. Contexts can be separated by a comma';
20+
$_lang['tagger.gettags.contexts_desc'] = 'If set, will display only tags for resources in given contexts. Contexts can be separated by a comma';
21+
$_lang['tagger.gettags.toPlaceholder_desc'] = 'If set, output will return in placeholder with given name';

0 commit comments

Comments
 (0)