Skip to content

Commit

Permalink
Temporary fix for WP 5.5 wpColorPickerL10n issue. Fixes #140
Browse files Browse the repository at this point in the history
  • Loading branch information
bwmarkle committed Jul 23, 2020
1 parent 0643f7f commit 74c5724
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions includes/class-boldgrid-editor-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,12 @@ public function enqueue_scripts() {
* Enqueue scripts to be used on the page and post editor.
*
* @since 1.2.3
*
* @global string $wp_version Current WordPress version.
*/
public function enqueue_drag_scripts() {
global $wp_version;

$plugin_file = BOLDGRID_EDITOR_PATH . '/boldgrid-editor.php';

// Dependencies.
Expand Down Expand Up @@ -429,6 +433,32 @@ public function enqueue_drag_scripts() {
$this->get_js_vars()
);

/*
* Localize wp-color-picker.
*
* This is only needed in WordPress >= 5.5 because wpColorPickerL10n has been removed.
* @see https://github.com/WordPress/WordPress/commit/7e7b70cd1ae5772229abb769d0823411112c748b
*
* This is only needed until the wp-color-picker-alpha repo has been updated.
* @see https://github.com/kallookoo/wp-color-picker-alpha/issues/35
*
* The preg_replace is needed to change 5.5-beta3-48571 to 5.5-3-48571 so that the version_compare
* will work properly during the beta phase.
*/
if ( version_compare( preg_replace( "/[^0-9.-]/", "", $wp_version ), '5.5', '>=' ) ) {
wp_localize_script(
'wp-color-picker',
'wpColorPickerL10n',
array(
'clear' => __( 'Clear' ),
'clearAriaLabel' => __( 'Clear color' ),
'defaultString' => __( 'Default' ),
'defaultAriaLabel' => __( 'Select default color' ),
'pick' => __( 'Select Color' ),
'defaultLabel' => __( 'Color value' ),
) );
}

wp_enqueue_script( 'boldgrid-editor-drag' );


Expand Down

0 comments on commit 74c5724

Please sign in to comment.