Support » Plugin: ACF RGBA Color Picker » Errors in debug mode

  • Resolved kierancalv

    (@kierancalv)



    Hi

    Thanks for the new version of this great plugin.

    The colour palette ability is really great! I have connected it to my redux options page. I have included the code in my functions.php to add the palette and it works perfectly.

    However: The below errors show in debug mode and make the plugin unusable in Debug Mode.

    Notice: Undefined index: hide_palette in ………./wp-content/plugins/acf-rgba-color-picker/fields/acf-rgba-color-picker-v5.php on line 138

    Notice: Undefined index: color_palette in ……../wp-content/plugins/acf-rgba-color-picker/fields/acf-rgba-color-picker-v5.php on line 141

    I tried checking isset() on the vars but it broke the pallet.

    Thanks

    Kieran

    • This topic was modified 1 year, 6 months ago by  kierancalv.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author dreihochzwo

    (@tmconnect)

    Did you add anything to the acf-rgba-color-picker-v5.php, because the vars hide_palette and color_palette are called a few lines earlier.

    Could you please add print_r($field); as the first call to the render_field( $field ) function, to check if the field contains the vars.

    Did you get the “Color Palette” and “Hide Color Palette” options in the field editor?

    Cheers, Thomas

    Plugin Author dreihochzwo

    (@tmconnect)

    Looks like the problem did not exists anymore…

    kierancalv

    (@kierancalv)

    Hi Thanks for your help.

    i just noticed that the problem still exists however as the ‘hide_palette’ and ‘color_palette’ are not added to the field at this point. I have not edited the plugin

    I am using Multisite and the fields are inside a flexible content block.

    Here is the print_r as first call to the render_field( $field ) function:

    Array
    (
    [ID] => 0
    [key] => MY_VALUE
    [label] => Block Background Colour
    [name] => acf[MY_VALUE][0][MY_VALUE]
    [prefix] => acf[MY_VALUE][0]
    [type] => extended-color-picker
    [value] => #f1f2f2
    [menu_order] => 115
    [instructions] =>
    [required] => 0
    [id] => MY_VALUE
    [class] =>
    [conditional_logic] => 0
    [parent] => ______
    [wrapper] => Array
    (
    [width] => 50
    [class] => MY_VALUE
    [id] =>
    )

    [_name] => MY_VALUE
    [_prepare] => 1
    [_valid] => 1
    [parent_layout] => MY_VALUE
    [default_value] =>
    )

    Notice: Undefined index: hide_palette in ……./plugins/acf-rgba-color-picker/fields/acf-rgba-color-picker-v5.php on line 142

    Plugin Author dreihochzwo

    (@tmconnect)

    Could you please post the code from your functions.php where you included the code to add the palette.

    kierancalv

    (@kierancalv)

    Sure here you go:

    /* ACF RGBA Color Picker – Add Color Palette
    ————————————————————– */

    add_filter(‘acf/rgba_color_picker/palette’, ‘my_functionname’);

    function my_functionname() {

    foreach($REDUX_OPTION [‘color_palette’] as $color) {

    if($color) $palette[]= $color;

    }

    return $palette;
    }

    Plugin Author dreihochzwo

    (@tmconnect)

    That’s looking perfect – but maybe there’s something wrong with the returned $palette.

    Please add a print_r($palette); into the acf-rgba-color-picker-v5.php after the $palettes = apply_filters( "acf/rgba_color_picker/palette", true ); and let me know what do get there.

    Plugin Author dreihochzwo

    (@tmconnect)

    Sorry, it must be print_r($palettes); !!!

    kierancalv

    (@kierancalv)

    Here you go:

    Array
    (
    [0] => #fff
    [1] => #ddd
    [2] => #000
    )

    Notice: Undefined index: hide_palette in ……./wp-content/plugins/acf-rgba-color-picker/fields/acf-rgba-color-picker-v5.php on line 142

    Plugin Author dreihochzwo

    (@tmconnect)

    O.k. – that’s perfect, too.

    It’s strange, that you didn’t get the “hide_palette” and “color_palette” in the fields array.

    For me the plugin works correct and I get the correct fields array…

    Did you get the “Color Palette” and “Hide Color Palette” fields in the field editor?

    Maybe ACF didn’t save the field settings correctly. Try to save the field group again and check the fields array.

    If this didn’t solve the problem, please try to add a new RGBA Color Picker field into the Flexible Content and check if this field get the correct fields array.

    kierancalv

    (@kierancalv)

    Hi thanks for the update.

    This is now resolved

    I had included the Field with PHP and I did not have the “Color Palette” and “Hide Color Palette” keys in the array as I edited a basic color picker to change it to your plugin for the flexible content field.

    Once I added the fields to the array it works perfectly and errors are gone.

    Sorry i should have spotted that sooner 🙂

    Thanks for the great plugin 🙂

    Kieran

    Plugin Author dreihochzwo

    (@tmconnect)

    Great, that you have found the cause.

    Sometimes it’s sooo easy 😉

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Errors in debug mode’ is closed to new replies.