theboxer/Git-Package-Management

[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.

@hugopeek: So this PR #48 added what you wanted. So did I... ;)

Config example:

"sortOrder": "69",
"outputProperties": [{
    "delimiter": ","                    
}]

Need more testing... Let me know, please.

@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..

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|"
    }]                
}],
Jako commented

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.