Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typography option style select 2 selected options #389

Closed
ghost opened this issue Mar 21, 2015 · 0 comments
Closed

typography option style select 2 selected options #389

ghost opened this issue Mar 21, 2015 · 0 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Mar 21, 2015

OK one pesky bug is messing with me , I managed to get all options exactly as needed just the typography option style select is messing with me and gives me 2 selected options ,

this is what I have

    $values = json_decode($values['thzstyle'],true); // this one is 100% identical like DB options


foreach ( fw_extract_only_options($options) as $option_id => $option ) {

    if ( ! isset( $values[ $option_id ] ) ) {
        continue;
    }
    /**
     * We detect if option is using booleans by sending it a boolean input value
     * If it returns a boolean, then it works with booleans
     */
    if ( ! is_bool(
        fw()->backend->option_type( $option['type'] )->get_value_from_input( $option, true )
    )
    ) {
        continue;
    }
    if ( is_bool( $values[ $option_id ] ) ) {
        // value is already boolean, does not need to fix
        continue;
    }

    $values[ $option_id ] = ( $values[ $option_id ] === 'true' );
}

$html = fw()->backend->render_options( $options, $values, $data );
echo $html;

But I get this

http://prntscr.com/6j9jmq

this is the option array printed

[topmenu_font] => Array
    (
        [gadget] => inherit
        [custom] => Array
            (
                [topmenu_font_val] => Array
                    (
                        [size] => 12
                        [family] => Arial
                        [style] => 300
                        [color] => #000000
                    )

            )

    )

what am I missing ? value not a string or? if I do this in typography option

$data['value']['style'] === $key

instead of

$data['value']['style'] == $key

but that messes up the js selection on load. must be variable type. but how if the arrays are identical.

darn , it is , my array style is integer instead of string
http://prntscr.com/6j9pl0


Source #387 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant