[Question] How can I enter Sort Order and Output Delimiter properties for TV's?
Closed this issue · 7 comments
Or is this not (yet) possible?
This doesn't work yet.
@bartholomej Cool! Sortorder is already working nicely!! Delimiter is not.. When I set it manually after package update, it's not being overwritten either, so nothing is happening there yet I think..
Maybe it is because of using index 0 in the following lines:
https://github.com/TheBoxer/Git-Package-Management/blob/e057a8a5cae185dfb03d495b5446717e34513f74/core/components/gitpackagemanagement/processors/mgr/gitpackage/create.class.php#L607
https://github.com/TheBoxer/Git-Package-Management/blob/e057a8a5cae185dfb03d495b5446717e34513f74/core/components/gitpackagemanagement/processors/mgr/gitpackage/buildpackage.class.php#L367
https://github.com/TheBoxer/Git-Package-Management/blob/e057a8a5cae185dfb03d495b5446717e34513f74/core/components/gitpackagemanagement/processors/mgr/gitpackage/update.class.php#L387
The index does not occur in input_properties code.
OK, can anyone confirm this is really doesn't work? (@Jako)
I think the only problem is properties are not just being displayed properly (but delimiter is actually set).
How to try?
When you update package via GPM and open testtv
-> Output Options
you will probably see Default
(it's bug I know that).
Now change it manually to Delimiter
. Can you see my testing value: |pipe|
?
Can you confirm? (I'll fix that bug with displaying later)
Thanks
Use this test example:
"tvs": [{
"caption": "testTV",
"name": "testtv",
"type": "list",
"description": "This is the best TV",
"defaultValue": "second",
"inputOptionValues": "First==first||Second==second",
"templates": ["PackageTemplate"],
"properties": [{
"name": "testproperty",
"value": "testvalue"
}],
"inputProperties": [{
"allowBlank": false
}],
"outputProperties": [{
"delimiter": "|pipe|"
}]
}],
inputProperties are not set with the current code and the test example. outputProperties are set.
So your additions should be fine and $tvObject->set('input_properties',$inputProperties);
should be changed to $tvObject->set('input_properties',$inputProperties[0]);
in create & build processor.
EDIT: I think there is an issue in your test example. If I am right, it should be like this:
"tvs": [{
"caption": "testTV",
"name": "testtv",
"type": "listbox",
"description": "This is the best TV",
"defaultValue": "second",
"display": "delim",
"inputOptionValues": "First==first||Second==second",
"templates": ["PackageTemplate"],
"properties": [{
"name": "testproperty",
"value": "testvalue"
}],
"inputProperties": {
"allowBlank": false
},
"outputProperties": {
"delimiter": "|pipe|"
}
}],
$tvObject->set('input_properties',$outputProperties[0]);
should be changed to $tvObject->set('input_properties',$outputProperties);
in create & build processor. The documentation has to be changed too then. Or check if inputProperties/outputProperties are an array and use the name/value representation as in properties.
A small difference between GPM and normal TV creation: boolean values are saved different.
GPM saves "allowBlank";b:0
and MODX saves "allowBlank";s:5:"false"
. But both behave the same during editing the TV and a resource containing the TV.
This should be fixed in cc8b1d8
Also I added display
property: http://theboxer.github.io/Git-Package-Management/config/package/#template-variables