Skip to content

Commit 34239d5

Browse files
author
Ilyas Ronef
committed
Version 1.3
2 parents 59a8f6f + c462b6c commit 34239d5

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

ddselectdocuments/ddselectdocuments.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* mm_ddSelectDocuments
4-
* @version 1.2.2 (2014-02-14)
4+
* @version 1.3 (2016-06-06)
55
*
66
* @desc A widget for ManagerManager that makes selection of documents ids easier.
77
*
@@ -11,23 +11,23 @@
1111
* @param $tvs {comma separated string} - TVs names that the widget is applied to. @required
1212
* @param $roles {comma separated string} - Roles that the widget is applied to (when this parameter is empty then widget is applied to the all roles). Default: ''.
1313
* @param $templates {comma separated string} - Templates IDs for which the widget is applying (empty value means the widget is applying to all templates). Default: ''.
14-
* @param $parentIds {comma separated string} - Parent documents IDs. @required
14+
* @param $parentIds {comma separated string} - Parent documents IDs. Default: '0'.
1515
* @param $depth {integer} - Depth of search. Default: 1.
1616
* @param $filter {separated string} - Filter clauses, separated by '&' between pairs and by '=' between keys and values. For example, 'template=15&published=1' means to choose the published documents with template id=15. Default: ''.
1717
* @param $max {integer} - The largest number of elements that can be selected by user (“0” means selection without a limit). Default: 0.
1818
* @param $labelMask {string} - Template to be used while rendering elements of the document selection list. It is set as a string containing placeholders for document fields and TVs. Also, there is the additional placeholder “[+title+]” that is substituted with either “menutitle” (if defined) or “pagetitle”. Default: '[+title+] ([+id+])'.
19+
* @param $allowDoubling {boolean} - Allows to select duplicates values. Default: false.
1920
*
2021
* @event OnDocFormPrerender
2122
* @event OnDocFormRender
2223
*
23-
* @link http://code.divandesign.biz/modx/mm_ddselectdocuments/1.2.2
24+
* @link http://code.divandesign.biz/modx/mm_ddselectdocuments/1.3
2425
*
25-
* @copyright 2014, DivanDesign
26-
* http://www.DivanDesign.biz
26+
* @copyright 2013–2016 DivanDesign {@link http://www.DivanDesign.biz }
2727
*/
2828

29-
function mm_ddSelectDocuments($tvs = '', $roles = '', $templates = '', $parentIds, $depth = 1, $filter = '', $max = 0, $labelMask = '[+title+] ([+id+])'){
30-
if (empty($parentIds) || !useThisRule($roles, $templates)){return;}
29+
function mm_ddSelectDocuments($tvs = '', $roles = '', $templates = '', $parentIds = '0', $depth = 1, $filter = '', $max = 0, $labelMask = '[+title+] ([+id+])', $allowDoubling = false){
30+
if (!useThisRule($roles, $templates)){return;}
3131

3232
global $modx;
3333
$e = &$modx->Event;
@@ -130,16 +130,16 @@ function mm_ddSelectDocuments($tvs = '', $roles = '', $templates = '', $parentId
130130
);
131131
}
132132

133-
$output .= "//---------- mm_ddSelectDocuments :: Begin -----\n";
133+
$output .= '//---------- mm_ddSelectDocuments :: Begin -----'.PHP_EOL;
134134

135135
foreach ($tvs as $tv){
136136
$output .=
137137
'
138-
$j("#tv'.$tv['id'].'").ddMultipleInput({source: '.$jsonDocs.', max: '.$max.'});
138+
$j("#tv'.$tv['id'].'").ddMultipleInput({source: '.$jsonDocs.', max: '.(int) $max.', allowDoubling: '.(int) $allowDoubling.'});
139139
';
140140
}
141141

142-
$output .= "//---------- mm_ddSelectDocuments :: End -----\n";
142+
$output .= '//---------- mm_ddSelectDocuments :: End -----'.PHP_EOL;
143143

144144
$e->output($output);
145145
}

0 commit comments

Comments
 (0)