What is MIGX?
MIGX is a custom TV variable for aggregating multiple TVs into one. This aggregation greatly simplifies the workflow for Manager end users to add complex data items. A data item can consist of any number of any other TVs, including text, images, files, checkboxes, etc.
The package is highly customizable and allows the developer to define a custom input window for the MIGX TV. In this input window, items can be added, modified, and reordered.
The package also comes with a snippet (getImageList) that makes it easy to retrieve complex data items from a MIGX TV custom input type.
MIGX is an abbreviation for Multi Items Grid TV for MODX.
Installation
MIGX can be downloaded via the package manager from the main repository.
You can also download the transport package from the MODX repository here: https://modx.com/extras/package/migx
Configuration Highlights
- «formtabs» — modal window tabs, if there is only one tab, they are hidden;
- «caption» — the displayed name of something (be it a tab or a field);
- «field» — a unique name of the form field;
- «fields» — a list of form fields located on this tab, including:
— «name» — the «Name» text field
— «url» — the «Link» text field
— «image» — a field with an image selection — «Image»
— «active» — a list with a single selection (“Active” or “Hidden”).
Input and render parameters
- this.renderImage — image output;
- this.renderCrossTick — check\cross icons for boolean fields;
- this.renderClickCrossTick — check\cross icons for boolean fields with the ability to change the value by clicking (supported for MIGXdb);
- this.renderSwitchStatusOptions — changing the status by clicking on the field (configured via Renderoptions);
- this.renderChunk — you can specify a chunk that will be output for this field;
- this.renderDate — output dates.
Input/Field Types (inputTVtype)
- autotag – Auto-label;
- text – Text;
- textarea – Text area;
- textareamini – Text area (mini);
- richtext – Text editor;
- dropdown – Drop-down list;
- listbox – List (single selection);
- listbox-multiple – List (multiple selection);
- list-multiple-legacy – Legacy multiple selection list;
- option – Switches (radio);
- checkbox – Checkboxes (checkbox);
- image – Image;
- file – File;
- url – URL;
- email – Email;
- number – Number;
- date – Date;
- tag – Tag;
Renderer
- this.renderImage – image output;
- this.renderCrossTick – checkmark\cross icons for boolean fields;
- this.renderClickCrossTick — check\cross icons for boolean fields with the ability to change the value by clicking (supported for MIGXdb);
- this.renderSwitchStatusOptions — changing the status by clicking on the field (configured via Renderoptions)
- this.renderChunk — you can specify a chunk that will be output for this field
- this.renderDate — used to output the date
getImageList Placeholders
- [[+fieldname]] — any field from the MIGX configuration or from the parameters passed to the snippet
- [[+idx]] — serial number, starting with 1
- [[+_first]] — returns 1 if this is the first entry
- [[+_last]] — returns 1 if this is the last entry
- [[+_alt]] — returns 1 if this is an even entry
- [[+total]] — total number of items (can be changed via &totalVar)
- [[+property.name]] — outputs the parameter named &name= in the getImageList call.
getImageList Parameters
- &tvname — TV name with MIGX input type
- &tpl — chunk name to output each record. @CODE:, @FILE:, @FIELD can be used
- &docid — document ID to specify for the TV to process. Default: [[*id]]
- &value — JSON string to process by getImageList. If specified, &docid and &tvname parameters will be ignored. Another getImageList call can be used to output to getImageList
- &limit — number of records to output. Default: 0
- &offset — number of records to skip. Default: 0
- &totalVar — the name of the placeholder that contains the total number of records. Default: total
- &randomize — if set to 1, the results will be sorted randomly. Default: 0
- &preselectLimit — together with the &randomize parameter, you can specify the number of records that will be displayed in any case. Default: 5
- &where — JSON string with selection conditions, for example: {«active:=»:«1»,«rating:>»:«5»}
- &sort — JSON string with sorting conditions. You can specify multiple parameters: [{«sortby»:«age»,«sortdir»:«DESC»,«sortmode»:«numeric»},{«sortby»:«name»,«sortdir»:«ASC»}]
- &toPlaceholder — save the output to a placeholder
- &toSeparatePlaceholders — save each record to a separate placeholder.
- &outputSeparator — separator between results
- &wrapperTpl — chunk wrapper for outputting results. Accepts placeholder [[+output]] for outputting results
- &processTVs — enable the mode of processing the output of TV parameters (for fields with inputTV). Default: 1