This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Astra_Update_Transparent_Header::update_colors( array $colors )
Update color settings.
Description
Parameters
- $colors
-
(array) (Required) Color settings array.
Return
(void)
Source
File: inc/abilities/customizer/header/transparent/class-astra-update-transparent-header.php
private function update_colors( $colors ) {
if ( isset( $colors['logo_color'] ) ) {
astra_update_option( 'transparent-header-logo-color', sanitize_text_field( $colors['logo_color'] ) );
}
// Responsive color options mapping.
$responsive_color_map = array(
'site_title' => 'transparent-header-color-site-title-responsive',
'site_title_hover' => 'transparent-header-color-h-site-title-responsive',
'menu_color' => 'transparent-menu-color-responsive',
'menu_bg_color' => 'transparent-menu-bg-color-responsive',
'menu_hover_color' => 'transparent-menu-h-color-responsive',
'submenu_color' => 'transparent-submenu-color-responsive',
'submenu_bg_color' => 'transparent-submenu-bg-color-responsive',
'submenu_hover_color' => 'transparent-submenu-h-color-responsive',
'content_link_color' => 'transparent-content-section-link-color-responsive',
'content_link_hover_color' => 'transparent-content-section-link-h-color-responsive',
);
foreach ( $responsive_color_map as $key => $option_key ) {
if ( isset( $colors[ $key ] ) && is_array( $colors[ $key ] ) ) {
$sanitized = $this->sanitize_responsive_color( $colors[ $key ] );
astra_update_option( $option_key, $sanitized );
}
}
// Header background colors (nested: above, primary, below).
if ( isset( $colors['header_bg'] ) && is_array( $colors['header_bg'] ) ) {
$bg_map = array(
'above' => 'hba-transparent-header-bg-color-responsive',
'primary' => 'transparent-header-bg-color-responsive',
'below' => 'hbb-transparent-header-bg-color-responsive',
);
foreach ( $bg_map as $key => $option_key ) {
if ( isset( $colors['header_bg'][ $key ] ) && is_array( $colors['header_bg'][ $key ] ) ) {
$sanitized = $this->sanitize_responsive_color( $colors['header_bg'][ $key ] );
astra_update_option( $option_key, $sanitized );
}
}
}
}
Expand full source code Collapse full source code View on Trac