Creating/updating a category with text is not working.
Creating or updating a category field will not change it's text value. It will continue to stay blank. I have currently tried creating the field with the 'options' tag into an array, with no results and then tried to just update the field again with the 'options' tag, same result.
Latest code for creating:
$fieldattributes = array('type' => 'category', 'config' => [
'label' => 'Category',
'required' => false,
'options' => [
'text' => 'value',
]
]);
PodioAppField::create( $app_id, $fieldattributes );
I can easily create the app with the label, it just will not take the options attribute and apply a value
-
Hey Marek, thanks for the help it works. Can you explain the workflow a bit? I don't seem to understand how this works out, specifically in the double options array?
This:
'settings' => [
'options' => [
[
'text' => 'value',
]
]
]
is the equivalent to'settings' => [
'options' => [[
'text' => 'value',
]]
]
right?
So why make an array inside an array? -
Take a look at "category" section in applications documentation - "options" is a collection of option objects. It looks like this in JSON format:
options = [
{ "text": "option 1" , "color": "..." },
{ "text": "option 2" , [..] },
{ "text": "option 3" , [..] }
]br
Marek
Please sign in to leave a comment.
Comments
3 comments