Compatibility with Blocksy 2.0.0 palettes.

This commit is contained in:
mateuswetah 2023-05-24 10:04:42 -03:00
parent 0ac51d7b80
commit e35bcc0b0a
2 changed files with 114 additions and 98 deletions

View File

@ -34,7 +34,7 @@ $options = [
'color6' => [ 'color' => 'var(--form-field-border-initial-color, #e0e5eb)' ], 'color6' => [ 'color' => 'var(--form-field-border-initial-color, #e0e5eb)' ],
'current_palette' => 'palette-1', 'current_palette' => 'palette-1',
],
'palettes' => [ 'palettes' => [
[ [
'id' => 'palette-1', 'id' => 'palette-1',
@ -71,7 +71,6 @@ $options = [
'color6' => [ 'color' => '#1a1a1a' ] 'color6' => [ 'color' => '#1a1a1a' ]
] ]
]
], ],
'sync' => '', 'sync' => '',
], ],
@ -97,7 +96,8 @@ $options = [
'color3' => [ 'color' => 'var(--color, #454647)' ], 'color3' => [ 'color' => 'var(--color, #454647)' ],
'color4' => [ 'color' => '#555758' ], 'color4' => [ 'color' => '#555758' ],
'color5' => [ 'color' => 'var(--formTextInitialColor, #454647)' ], 'color5' => [ 'color' => 'var(--formTextInitialColor, #454647)' ],
'current_palette' => 'palette-1', 'current_palette' => 'palette-1'
],
'palettes' => [ 'palettes' => [
[ [
'id' => 'palette-1', 'id' => 'palette-1',
@ -130,8 +130,17 @@ $options = [
'color5' => [ 'color' => '#f0f0f0' ] 'color5' => [ 'color' => '#f0f0f0' ]
] ]
]
], ],
'sync' => '', 'sync' => '',
] ]
]; ];
/* Backwards compatibility with previous palette settings */
if ( wp_get_theme()->get('Version') <= '1.9' ) {
$options[$prefix . 'items_list_background_palette']['value']['palettes'] = $options[$prefix . 'items_list_background_palette']['palettes'];
unset($options[$prefix . 'items_list_background_palette']['palettes']);
$options[$prefix . 'items_list_text_palette']['value']['palettes'] = $options[$prefix . 'items_list_text_palette']['palettes'];
unset($options[$prefix . 'items_list_text_palette']['palettes']);
}

View File

@ -4,13 +4,7 @@ if (! isset($prefix)) {
$prefix = ''; $prefix = '';
} }
$options = [ $inner_options = [
blocksy_rand_md5() => [
'type' => 'ct-condition',
'condition' => [
$prefix . 'page_structure_type' => 'type-gtm'
],
'options' => [
$prefix . 'document_attachments_colors' => [ $prefix . 'document_attachments_colors' => [
'label' => __( 'Color palette for the media above title', 'tainacan-blocksy' ), 'label' => __( 'Color palette for the media above title', 'tainacan-blocksy' ),
'type' => 'ct-color-palettes-picker', 'type' => 'ct-color-palettes-picker',
@ -26,7 +20,7 @@ $options = [
'color3' => [ 'color' => 'var(--paletteColor1, #3eaf7c)' ], 'color3' => [ 'color' => 'var(--paletteColor1, #3eaf7c)' ],
'current_palette' => 'palette-1', 'current_palette' => 'palette-1',
],
'palettes' => [ 'palettes' => [
[ [
'id' => 'palette-1', 'id' => 'palette-1',
@ -45,11 +39,24 @@ $options = [
'color3' => [ 'color' => 'var(--paletteColor2, #33a370)' ] 'color3' => [ 'color' => 'var(--paletteColor2, #33a370)' ]
] ]
]
], ],
'sync' => '', 'sync' => '',
] ]
] ];
/* Backwards compatibility with previous palette settings */
if ( wp_get_theme()->get('Version') <= '1.9' ) {
$inner_options[$prefix . 'document_attachments_colors']['value']['palettes'] = $inner_options[$prefix . 'document_attachments_colors']['palettes'];
unset($inner_options[$prefix . 'document_attachments_colors']['palettes']);
}
$options = [
blocksy_rand_md5() => [
'type' => 'ct-condition',
'condition' => [
$prefix . 'page_structure_type' => 'type-gtm'
],
'options' => $inner_options
] ]
]; ];