Inline options group option type suggestion
This one is for other Unyson users , I already made my own but this can come in handy to others. I got bit tired of adding easy to understand options under each other and not using the space so I combined my spinner, short-text and short-select in to one option
the outcome

array output

option array
'group_of_options' => array(
'type' => 'thz-multi-options',
'label' => __('Option group', 'fw'),
'desc' => __('This is the space between the element and the surrounding elements.', 'fw'),
'value' => array(
'type_spinner' =>20,
'type_text' =>'I am a text',
'type_select' =>'select3'
),
'thz_options' => array(
'type_spinner' => array(
'type' =>'spinner',
'title' => __('Spinn me', 'fw'),
'addon' => 'px',
'min' => 0,
'max' => 100
),
'type_text' => array(
'type' =>'text',
'title' => __('Some text', 'fw'),
),
'type_select' => array(
'type' =>'select',
'title' => 'Select something',
'choices' => array(
'select1' => __('select1', 'fw'),
'select2' => __('select2', 'fw'),
'select3' => __('select3', 'fw')
),
)
)
),
thnx to @moldcraft for help and this suggestion https://github.com/ThemeFuse/Unyson/issues/1061
note that I have my own spinner which is not included in Unyson but you get the idea why something like this can be useful.
Here is dummy scenario for slider setup

here I just combined
spinner text short-text select short-select color picker

output

In the Unyson already exists this prototype , the multi option-type the main difference is in design , the @danyj s option type show the options horizontal the multi option type show it as simple option types but in the database is grouped in one key.
@llemurya I know , saw it already , you might want to add inline option in there than if you decide. As you can see this is compact for fast options that need no explaining. Here is my usage example http://prntscr.com/99ei20 all of those are easy to understand and if not I can add help in there.
Check this out , http://prntscr.com/99eir8
now if I were to add those under each other my modal would already be full.
Hi danyj,
Can you share your thz-multi-options? Can we add this to core? I agree that's it's crucial to have mutli-inline options.
Love this way. Share with us buddy :)
making one for u , few min
OK , see if you can get this https://www.dropbox.com/s/sr90buxpdzu6tu0/fw-multi-inline.zip?dl=0
extract and drop the folder in
yourtheme/inc/includes/option-types/
open file
option-types.php
and include the class ,
my option-types.php is in
mytheme/inc/includes/
so my include path is
require_once dirname(__FILE__) . '/option-types/fw-multi-inline/class-fw-option-type-fw-multi-inline.php';
the option is now called
fw-multi-inline
and this is how it is used
'multiinlintest' => array(
'type' => 'fw-multi-inline',
'label' => __('Option group', 'fw'),
'desc' => __('This is the space between the element and the surrounding elements.', 'creatus'),
'value' => array(
'type_text' =>'I am longer than the other',
'type_short_text' =>'I am short',
'type_short_select' =>'select3',
'type_select' =>'select2',
'type_color' =>'#ff6600',
'type_rgbacolor' =>'#ff0000'
),
'fw_multi_options' => array(
'type_short_text' => array(
'type' =>'short-text',
'title' => __('Short text', 'fw'),
),
'type_text' => array(
'type' =>'text',
'title' => __('Longer text', 'fw'),
),
'type_short_select' => array(
'type' =>'short-select',
'title' => 'Select something',
'choices' => array(
'select1' => __('select1', 'fw'),
'select2' => __('select2', 'fw'),
'select3' => __('select3', 'fw')
),
),
'type_select' => array(
'type' =>'select',
'title' => 'Select something longer',
'choices' => array(
'select1' => __('Select something larger', 'fw'),
'select2' => __('Select something larger 2', 'fw'),
'select3' => __('Select something larger 3', 'fw')
),
),
'type_color' => array(
'type' =>'color',
'title' => __('I am a color', 'fw'),
),
'type_rgbacolor' => array(
'type' =>'rgbacolor',
'title' => __('I am a rgba color', 'fw'),
),
)
),
This is backend

And this is option print

you can add these options
text
short-text
select
short-select
color
rgbacolor
here is short example
'multiinlintest' => array(
'type' => 'fw-multi-inline',
'label' => __('Option group', 'fw'),
'desc' => __('This is the space between the element and the surrounding elements.', 'creatus'),
'value' => array(
'type_short_text' =>'I am short',
),
'fw_multi_options' => array(
'type_short_text' => array(
'type' =>'short-text',
'title' => __('Short text', 'fw'),
),
)
),
Have fun!
Note that I dont like hiding errors so I purposely let the option error out if your option index is missing. This way it keeps me in check. So if you see a notice like this

you should check the name of your value key

You have built some awesome option types. ;) if possible please share #911 this one to :)
Thanks very much mate.
glad you like it , here is the icon option https://github.com/ThemeFuse/Unyson/issues/911#issuecomment-173953084
Ahh got it :beers:
Thanks for putting that up!
How do you get the popup button working with this multi-inline option? I'm getting Error: wrong option when I hit the button. It doesn't look like data-for-js get's the data.
Got the popup working. When passing the sub option to render for html: html .= fw()->backend->option_type( $type )->render($id, $option, $data)
You need to pass the nested option for popup: $option['fw_multi_options'][$key] OR you can explicitly pieces of the sub option array.
as advised in description , I made this work only for these
text short-text select short-select color rgbacolor
what you do with it is up to you
Thanks danyj. How do you access the $atts value of a nested popup option?
For example, I have: 'foo' => array( 'type' => 'fw-multi-inline'... 'value'=> ... 'fw_multi_options' =>.... 'bar' => 'type' => 'popup',
If I dump $atts['foo'] I only get the default values in the value array for bar. I can't access bar directly.
Wow dude! Thank you so much!
I got a class error when I included the files. So I just hook them up.
function _action_theme_include_custom_option_types() {
require_once dirname(__FILE__) . '/includes/option-types/fw-multi-inline/class-fw-option-type-fw-multi-inline.php';
}
add_action('fw_option_types_init', '_action_theme_include_custom_option_types');
Cheers!
Something like this in the Unyson core would be awesome. The Theme Options pages can get quite lengthy since all options are positioned vertically by default.
Thanks for sharing @danyj!!