vafour / vafpress-framework

Wordpress theme options framework, check out the demo.
http://demo.vafpress.com/vafpress-framework
Other
240 stars 98 forks source link

[+] multitextbox field #35

Closed kpodemski closed 4 years ago

kpodemski commented 10 years ago

Example:

array(
                                    'type' => 'multitextbox',
                                    'name' => 'mtb_1',
                                    'label' => __('MultiText Box', 'vp_textdomain'),
                                    'items' => array(
                                        array(
                                            'value' => 'value_1',
                                            'label' => __('Label 1', 'vp_textdomain'),
                                        ),
                                        array(
                                            'value' => 'value_2',
                                            'label' => __('Label 2', 'vp_textdomain'),
                                        ),
                                        array(
                                            'value' => 'value_3',
                                            'label' => __('Label 3', 'vp_textdomain'),
                                        ),
                                    ),
                                    'default' => array(
                                        'value_1',
                                    ),
                                ),
kpodemski commented 10 years ago

http://www.screenr.com/Dk3H

daviedR commented 10 years ago

Hi @kpodemski , this is really interesting! Have you make this field compatible for Metabox and Shortcode Generator as well?

cyberwani commented 10 years ago

:+1:

kpodemski commented 10 years ago

I did compatibility with metaboxes but how do you join multiple values in the shortcodes generator?

I also wonder about...

1 Where to keep the global styles such as for the link .vp-deletion? 2 .js for multitext box should be in shared.js There are no events on.click so I keep that in shortcode-menu at this moment

kpodemski commented 10 years ago

Anyone still here? :worried:

ayublin commented 10 years ago

Hi @kpodemski, yes we're here, sorry for being absent, it's been a super busy week and I think will continue to the end of this week :(

Hope you can bear with us and I will get back to you soon. Many many thanks mate!

ayublin commented 10 years ago

Hi, I will take a look into this today and get back to you soon, sorry for the delay.

kpodemski commented 10 years ago

Okey!

ayublin commented 10 years ago

Hi @kpodemski,

First of all, I am really excited to see you dive into Vafpress Core and come up with something new!

I just downloaded and tried you multitextbox branch, there are several things I have in mind:

  1. I think you don't have to utilize the items key in the array since that key should be used for fixed options control such as select box, check box and etc. And from what I see you utilize the items key as a kind of default values, I think you could use only the default key for this.
  2. Upon Add more button there are 2 textboxes added, I personally think 1 textbox is the expected behavior.
  3. I can see that the field is working fine in theme options and metabox, but as you asked, it's not really supported in shortcode generator due to how our validationVal function works, the function detect the multitextbox as a single textbox and only return the last value.

We have a plan for the next big version of Vafpress, that is to generalize all the features, including the fields interaction feature, logical grouping, repeating field and group to be enabled everywhere: theme options, metabox or shortcode generators. Also we wish to supports widget form generation with the Vafpress. Those will open up for huge possibilities. It will also make it possible to achieve multitextbox field by utilizing repeating field upon textbox.

That will be a long journey tough, and we will be happy if you're willing to be a contributor :)

And as for multitextbox field you made, you can still use the field without touching the core, please refer to this documentation on creating your own field by extending the class: http://vafpress.com/documentation/vafpress-framework/controls/customfields.html

Please let me know if the documentation is unclear or there is a problem that preventing you to build the new field via the extending method.

kpodemski commented 10 years ago

Hi @ayublin,

Thanks for reply. I left this PR, someone who needs multitextbox now can use my code or being inspired to create something new.

That's what I miss most is the ability to create more flexible dependencies and I hope you are working on it.

As soon as there here be some alpha/beta of new Vafpress I be glad to help you.

Can't wait for informations about new version :)

ayublin commented 10 years ago

Good Idea!

Could you explain more about "more flexible dependencies"? what's missing from the current dependencies features? I would love to hear your feedbacks on this :)

Really glad to know that, you will be one of the people we will notify first !