WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.47k stars 4.18k forks source link

Core palette can no longer be overridden from PHP #36489

Closed steveangstrom closed 2 years ago

steveangstrom commented 2 years ago

Description

Setting brand colours no longer works in gutenberg it's working fine in WP 5.8.2 it is not working in Gutenberg Version 11.9.0

Core colours can no longer be removed.

Removing "core" colours is VITAL for branded corporate sites.

PHP support is VITAL for established sites and those being developed away from your bleeding edge

Step-by-step reproduction instructions

METHOD

in PHP enter this in a theme functions.php

function sc_custom_gutenberg_custom_color_palette() { add_theme_support( 'editor-color-palette', array( array( 'name' => __( 'Light Text', 'sc' ), 'slug' => 'light-text', 'color' => '#FFFFFF', ), array( 'name' => __( 'Darker Text', 'sc' ), 'slug' => 'darker-text', 'color' => '#535353', ), array( 'name' => __( 'Amaranth', 'sc' ), 'slug' => 'main-amaranth', 'color' => '#E23448', ), ) ); } add_action( 'after_setup_theme', 'sc_custom_gutenberg_custom_color_palette', 20 );

the editor will continue to show the awful "core" colours + the new array

Screenshots, screen recording, code snippet

WP 5.8.2 core - colours can be set correctly

core-cols-override-wp-582

Gutenberg Version 11.9.0 - awful colours persist gut-col-disaster

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

steveangstrom commented 2 years ago

The issue is not present in Version 11.8.3

Rolling back to Version 11.8.3 on problem websites temporarily masks the issue and hides "core" palettes until a more acceptable resolution is found.

fabiankaegy commented 2 years ago

@steveangstrom the fix hat was done in #36492 only applies to theme.json.

I suppose you could probably filter the editor settings like so:

add_filter(
    'block_editor_settings_all',
    'remove_core_color_palette_support_from_editor_settings'
);

/**
 * This function removes the Core Palette and Gradients fron the Color Pickers
 *
 * @param array $settings block editor settings
 */
function remove_core_color_palette_support_from_editor_settings( $settings ) {
    $settings['color']['corePalette'] = false;
    $settings['color']['coreGradients'] = false;
    return $settings;
}

I haven't tested it though.

steveangstrom commented 2 years ago

No, that does not work

WP 5.8.2 Gutenberg 11.9 added filter above

RESULT color-fail

The very major problem I have with Gutenberg and all recent WP development is this casual attitude to real world commercial sites. This feature is relatively recently introduced: https://make.wordpress.org/core/2020/01/23/controlling-the-block-editor/

many commercial site creators like me follow those docs, we've delivering sites in the last 18 months trying to keep up with this shifting unstable pile of features. Now we have a bleeding edge assumption that everyone is running json themes, which are barely even LAUNCHED.

Please stop treating PHP as some kind of niche afterthought PHP is not legacy, it is the basis of 99% of sites running WP.

This feverish JS fetish Gutenberg community is an ivory tower academic bubble and it makes me furious as everyone pats themselves on the back for theoretical successes - as I'm constantly trying to deliver real world sites and the foundations are shifting every week.

please. Gutenberg Devs. Look at the CMS corporate site community and consider us just a little bit, I am absolutely begging you, for gods sake.

steveangstrom commented 2 years ago

This is NOT FIXED in Gutenberg 12.0.1

Current status. No theme.json. Colours defined in functions.php. Palette is a still mess on all sites using Gutenberg.

Sites on 12.0.1 are broken as shown below. I assume the only "fix" is to roll back to Gutenberg 11.8.3

INCORRECT (Gutenberg 12.0.1) Screenshot 2021-11-26 at 00-01-00 Add New Page ‹ Sitename — WordPress

CORRECT ( rolled back to 11.8.3) Screenshot 2021-11-26 at 00-26-43 Edit Page ‹ Sitename — WordPress

oandregal commented 2 years ago

Hey Steve, the patch that hides the core palette for themes with no theme.json by default is going to be part of Gutenberg 12.1 which is a few days away.