|
1 | | -# mm_ddSelectDocuments |
| 1 | +# (MODX)EvolutionCMS.plugins.ManagerManager.mm_ddSelectDocuments |
2 | 2 |
|
3 | | -Visit the following [link](http://code.divandesign.biz/modx/mm_ddselectdocuments) to read the documentation, instructions & changelog. |
| 3 | +A widget for ManagerManager that makes selection of documents IDs easier. |
| 4 | + |
| 5 | + |
| 6 | +## Requires |
| 7 | + |
| 8 | +* PHP >= 5.4 |
| 9 | +* [(MODX)EvolutionCMS.plugins.ManagerManager](https://code.divandesign.biz/modx/managermanager) >= 0.7 |
| 10 | + |
| 11 | + |
| 12 | +## Installation |
| 13 | + |
| 14 | +To install you must unzip the archive to `/assets/plungins/managermanager/widgets/ddselectdocuments/`. |
| 15 | + |
| 16 | + |
| 17 | +You may also read this documentation: |
| 18 | +* [(MODX)EvolutionCMS.plugins.ManagerManager](https://code.divandesign.biz/modx/managermanager). |
| 19 | +* [(MODX)EvolutionCMS.modules.ddMMEditor](https://code.divandesign.biz/modx/ddmmeditor). |
| 20 | + |
| 21 | + |
| 22 | +## Parameters description |
| 23 | + |
| 24 | +* `$params` |
| 25 | + * Desctription: Parameters, the pass-by-name style is used. |
| 26 | + * Valid values: |
| 27 | + * `stdClass` |
| 28 | + * `arrayAssociative` |
| 29 | + * **Required** |
| 30 | + |
| 31 | +* `$params->fields` |
| 32 | + * Desctription: The names of TVs for which the widget is applied to. |
| 33 | + * Valid values: `stringCommaSeparated` |
| 34 | + * **Required** |
| 35 | + |
| 36 | +* `$params->parentIds` |
| 37 | + * Desctription: Parent documents IDs. |
| 38 | + * Valid values: |
| 39 | + * `array` |
| 40 | + * `stringCommaSeparated` |
| 41 | + * Default value: `[0]` |
| 42 | + |
| 43 | +* `$params->parentIds[$i]` |
| 44 | + * Desctription: Document ID. |
| 45 | + * Valid values: |
| 46 | + * `integer` |
| 47 | + * `'current'` — current document ID (for select children) |
| 48 | + * **Required** |
| 49 | + |
| 50 | +* `$params->depth` |
| 51 | + * Desctription: Depth of search. |
| 52 | + * Valid values: `integer` |
| 53 | + * Default value: `1` |
| 54 | + |
| 55 | +* `$params->filter` |
| 56 | + * Desctription: Filter clauses, separated by `'&'` between pairs and by `'='` or `'!='` between keys and values. |
| 57 | + For example, `'template=15&published=1'` means to choose the published documents with template ID == 15. |
| 58 | + * Valid values: `stringSeparated` |
| 59 | + * Default value: — |
| 60 | + |
| 61 | +* `$params->listItemLabelMask` |
| 62 | + * Desctription: Template to be used while rendering elements of the document selection list. |
| 63 | + It is set as a string containing placeholders of document fields and TVs. |
| 64 | + Also, there is the additional placeholder `[+title+]` that is substituted with either `menutitle` (if defined) or `pagetitle`. |
| 65 | + * Valid values: `string` |
| 66 | + * Default value: `'[+title+] ([+id+])'` |
| 67 | + |
| 68 | +* `$params->maxSelectedItems` |
| 69 | + * Desctription: The largest number of elements that can be selected by user. |
| 70 | + * Valid values: |
| 71 | + * `integer` |
| 72 | + * `0` — means selection without a limit |
| 73 | + * Default value: `0` |
| 74 | + |
| 75 | +* `$params->allowDuplicates` |
| 76 | + * Desctription: Allows to select duplicates values. |
| 77 | + * Valid values: `boolean` |
| 78 | + * Default value: `false` |
| 79 | + |
| 80 | +* `$params->roles` |
| 81 | + * Desctription: The CMS user roles that the widget is applied to. |
| 82 | + * Valid values: |
| 83 | + * `stringCommaSeparated` |
| 84 | + * `''` — when this parameter is empty then widget is applied to the all roles |
| 85 | + * Default value: `''` |
| 86 | + |
| 87 | +* `$params->roles[$i]` |
| 88 | + * Desctription: CMS user role ID. |
| 89 | + * Valid values: `integer` |
| 90 | + * **Required** |
| 91 | + |
| 92 | +* `$params->templates` |
| 93 | + * Desctription: Document templates IDs for which the widget is applied to. |
| 94 | + * Valid values: |
| 95 | + * `stringCommaSeparated` |
| 96 | + * `''` — empty value means the widget is applying to all templates |
| 97 | + * Default value: `''` |
| 98 | + |
| 99 | +* `$params->templates[$i]` |
| 100 | + * Desctription: Template ID. |
| 101 | + * Valid values: `integer` |
| 102 | + * **Required** |
| 103 | + |
| 104 | + |
| 105 | +## CMS events |
| 106 | + |
| 107 | +* `OnDocFormPrerender` |
| 108 | +* `OnDocFormRender` |
| 109 | + |
| 110 | + |
| 111 | +## Examples |
| 112 | + |
| 113 | + |
| 114 | +### Select 3 favorite published products |
| 115 | + |
| 116 | +```php |
| 117 | +mm_ddSelectDocuments([ |
| 118 | + //TV for which the widget is applied to |
| 119 | + 'fields' => 'favoriteProducts', |
| 120 | + //Let 314 is ID of catalog document, that contains children-products |
| 121 | + 'parentIds' => [314], |
| 122 | + //Search in 3 levels |
| 123 | + 'depth' => 3, |
| 124 | + //Display only published documents with template ID == 42 |
| 125 | + 'filter' => 'template=42&published=1', |
| 126 | + //Only 3 or less products can be selected |
| 127 | + 'maxSelectedItems' => 3 |
| 128 | +]); |
| 129 | +``` |
| 130 | + |
| 131 | + |
| 132 | +## Links |
| 133 | + |
| 134 | +* [Home page](https://code.divandesign.biz/modx/mm_ddselectdocuments) |
| 135 | +* [Telegram chat](https://t.me/dd_code) |
| 136 | +* [Packagist](https://packagist.org/packages/dd/evolutioncms-plugins-managermanager-mm_ddselectdocuments) |
| 137 | + |
| 138 | + |
| 139 | +<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" /> |
0 commit comments