| @@ -51,8 +51,9 @@ | ||
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Returns Progress Bar block markup |
| 54 | 54 | * |
| 55 | + * @since 3.1.0 Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus | |
| 55 | 56 | * @since 2.9.0 |
| 56 | 57 | **/ |
| 57 | 58 | public function renderCallback($attributes) |
| 58 | 59 | { |
| @@ -57,9 +58,16 @@ | ||
| 57 | 58 | public function renderCallback($attributes) |
| 58 | 59 | { |
| 59 | 60 | $progressBar = new ProgressBar( |
| 60 | 61 | [ |
| 61 | - 'ids' => $attributes['ids'], | |
| 62 | + 'ids' => array_map( | |
| 63 | + static function ($id) { | |
| 64 | + _give_redirect_form_id($id); | |
| 65 | + | |
| 66 | + return $id; | |
| 67 | + }, | |
| 68 | + $attributes['ids'] | |
| 69 | + ), | |
| 62 | 70 | 'tags' => $attributes['tags'], |
| 63 | 71 | 'categories' => $attributes['categories'], |
| 64 | 72 | 'goal' => $attributes['goal'], |
| 65 | 73 | 'enddate' => $attributes['enddate'], |
| @@ -98,13 +106,16 @@ | ||
| 98 | 106 | 'color' => '#777777', |
| 99 | 107 | ], |
| 100 | 108 | ]; |
| 101 | 109 | $editorColorPalette = get_theme_support('editor-color-palette'); // Return value is in a nested array. |
| 110 | + | |
| 102 | 111 | wp_localize_script( |
| 103 | 112 | 'give-blocks-js', |
| 104 | 113 | 'giveProgressBarThemeSupport', |
| 105 | 114 | [ |
| 106 | - 'editorColorPalette' => $editorColorPalette ? array_shift($editorColorPalette) : $defaultColorPalette, | |
| 115 | + 'editorColorPalette' => is_array($editorColorPalette) ? array_shift( | |
| 116 | + $editorColorPalette | |
| 117 | + ) : $defaultColorPalette, | |
| 107 | 118 | ] |
| 108 | 119 | ); |
| 109 | 120 | } |
| 110 | 121 | } |