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

Color pickers resetting back to default values when value is empty #2025

Closed
danyj opened this issue Sep 17, 2016 · 6 comments
Closed

Color pickers resetting back to default values when value is empty #2025

danyj opened this issue Sep 17, 2016 · 6 comments

Comments

@danyj
Copy link
Contributor

danyj commented Sep 17, 2016

The color pickers are resetting back to default value if empty value is saved.

http://take.ms/QU8In

'ddda' => array(
    'label' => __( 'RGBA Color Picker', 'unyson' ),
    'type'  => 'rgba-color-picker',
    'value' => '#ff6600',
    'desc'  => __( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
        'unyson' ),
    'help'  => sprintf( "%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
        __( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
            'unyson' ),
        __( 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium',
            'unyson' )
    ),
),

You are left with visual reference that the value is empty until you refresh the page.
Users should be able to delete color value if they need to . Think of it this way, you set default blue color for button and user wants a button with no background. With current pickers they will never be able to do so.

@ghost ghost self-assigned this Sep 19, 2016
@ghost ghost closed this as completed in c8cd0ad Sep 19, 2016
@ghost
Copy link

ghost commented Sep 19, 2016

Please test

@danyj
Copy link
Contributor Author

danyj commented Sep 19, 2016

@moldcraft tested color picker , works thnx!
rgba color picker needs same fix

@ghost ghost reopened this Sep 19, 2016
@ghost ghost closed this as completed in fa88a77 Sep 19, 2016
@danyj
Copy link
Contributor Author

danyj commented Sep 19, 2016

Rgba color picker , frontend works , backend still shows default value on page refresh
http://take.ms/7vhQR

@danyj
Copy link
Contributor Author

danyj commented Sep 19, 2016

this needs fixing

$option['attr']['value'] = empty($data['value']) ? $option['value'] : $data['value'];

@ghost ghost reopened this Sep 19, 2016
@danyj
Copy link
Contributor Author

danyj commented Sep 19, 2016

this works for that line

$option['attr']['value'] = is_null($data['value']) ? $option['value'] : $data['value'];

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

No branches or pull requests

1 participant