Code source wiki de Multilingual DBListManager Displayer
Modifié par Admin ATILLA le 2026/02/02 09:20
Afficher les derniers auteurs
| author | version | line-number | content |
|---|---|---|---|
| 1 | == Description == | ||
| 2 | |||
| 3 | Help you to display a field managed by [[Macros.MLDBListManager]]. | ||
| 4 | |||
| 5 | == Usage == | ||
| 6 | |||
| 7 | Instead of writing: | ||
| 8 | {{code}}$doc.getObject('MySpace.MyClass').display('myProperty'){{/code}} | ||
| 9 | |||
| 10 | You can write: | ||
| 11 | {{code}}{{mldblist_display property='myProperty' objClass='MySpace.MyClass' objNumber="$doc.getObject('MySpace.MyClass').getNumber()" /}}{{/code}} | ||
| 12 | |||
| 13 | Options are: | ||
| 14 | |||
| 15 | * "##property##" is the name of the field to display | ||
| 16 | * "##objClass##" is the class of the object to display | ||
| 17 | * "##objNumber##" is the number of the object to display | ||
| 18 | * "##objDoc##" is the document that contains the object to display (default: current document) | ||
| 19 | * "##mode##" is the mode of the rendering (could be 'view' or 'edit', default: the current edition mode) | ||
| 20 | * "##fieldName## is the name of the input field (only when the mode is 'edit', default: something like MySpace.MyClass_0_myProperty) | ||
| 21 | |||
| 22 | == Examples of use == | ||
| 23 | === The '$obj.display()' equivalent === | ||
| 24 | {{code}} | ||
| 25 | #set($obj = $doc.getObject('Test.NewClass')) | ||
| 26 | {{mldblist_display objNumber="$obj.getNumber()" objClass="Test.NewClass" property="test" /}} | ||
| 27 | {{/code}} | ||
| 28 | |||
| 29 | === The '$obj.get()' equivalent === | ||
| 30 | {{code}} | ||
| 31 | #set($obj = $doc.getObject('Test.NewClass')) | ||
| 32 | {{mldblist_display objNumber="$obj.getNumber()" objClass="Test.NewClass" property="test" mode="view"/}} | ||
| 33 | {{/code}} | ||
| 34 | |||
| 35 | === An object of an other document === | ||
| 36 | {{code}} | ||
| 37 | #set($document = $xwiki.getDocument('MyTest.MyDatas')) | ||
| 38 | #set($obj = $document.getObject('Test.NewClass')) | ||
| 39 | {{mldblist_display objNumber="$obj.getNumber()" objClass="Test.NewClass" property="test" objDoc='MyTest.MyDatas'/}} | ||
| 40 | {{/code}} | ||
| 41 | |||
| 42 | == Credits == | ||
| 43 | |||
| 44 | * Guillaume Delhumeau (XWiki SAS). |