Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Addable Popup: Delete Default

Open NwpDeveloper opened this issue 10 years ago • 4 comments

When I set a default for addable popup the default will load the value set in $options, which is fine. However, if I delete everything in the addable popup array the default will stay and cannot be removed.

I don't think this is the desired behavior because if you delete from a list you expect it to be gone. How can I modify this?

NwpDeveloper avatar Feb 11 '16 01:02 NwpDeveloper

Which default values should the popup have?

Please give the exact steps to reproduce the problem (an option array).

ghost avatar Feb 11 '16 18:02 ghost

So if I create a default value in an addable like below it will automatically add 1 txt object to the addable array by default. However, if I delete that txt object from the array it reappears because it loads it as default.

This is not the expected behavior because when you delete objects in an array you expect it to stay deleted. Its the same with a text option. You can set a default value in txt option where 'value'=>'hello world', but if you delete the default text you get an empty string. It doesn't and shouldn't return 'hello world' again after you deleted.

'txt_addable' =>array(
     'type' => 'addable-popup',
     'value' => array(
         '0' => array
         (
         'title_txt'=>array(...),
         'title_txt_size'=>array(...),
         ),
     ),
     'popup-options' => array(
          'title_txt' => array(...),
          'title_txt_size => array(...),
     ),
),

NwpDeveloper avatar Feb 11 '16 19:02 NwpDeveloper

https://github.com/ThemeFuse/Unyson/commit/01ba7a766babea343dd28863999c4e51e30b42a9

ghost avatar Feb 12 '16 15:02 ghost

Could you make this same/similar update with the "addable-box" option type? It would be nice to include a default value for new posts, but also allow users to delete all values and not have the default re-populate.

Thanks!

meta4creations avatar Apr 10 '16 17:04 meta4creations