Addon_Gutenberg_Editor_CSS::colors_and_background_addon_gutenberg_dynamic_css( string $dynamic_css, string $dynamic_css_filtered = '' )
Dynamic CSS – Colors and Background
Description
Parameters
- $dynamic_css
-
(string) (Required) Astra Gutenberg Dynamic CSS.
- $dynamic_css_filtered
-
(string) (Optional) Astra Gutenberg Dynamic CSS Filters.
Default value: ''
Return
(string)
Source
File: classes/class-addon-gutenberg-editor-css.php
public function colors_and_background_addon_gutenberg_dynamic_css( $dynamic_css, $dynamic_css_filtered = '' ) { $h1_color = astra_get_option( 'h1-color' ); $h2_color = astra_get_option( 'h2-color' ); $h3_color = astra_get_option( 'h3-color' ); $h4_color = astra_get_option( 'h4-color' ); $h5_color = astra_get_option( 'h5-color' ); $h6_color = astra_get_option( 'h6-color' ); $single_post_title_color = astra_get_option( 'entry-title-color' ); $parse_css = ''; /** * Colors and Background */ $colors_and_background_output = array( /** * Content <h1> to <h6> headings */ '.editor-styles-wrapper .block-editor-block-list__block h1, .wp-block-heading h1.editor-rich-text__tinymce, .editor-post-title__block .editor-post-title__input, .edit-post-visual-editor h1.block-editor-block-list__block' => array( 'color' => esc_attr( $h1_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h2, .wp-block-heading h2.editor-rich-text__tinymce, .edit-post-visual-editor h2.block-editor-block-list__block' => array( 'color' => esc_attr( $h2_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h3, .wp-block-heading h3.editor-rich-text__tinymce, .edit-post-visual-editor h3.block-editor-block-list__block' => array( 'color' => esc_attr( $h3_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h4, .wp-block-heading h4.editor-rich-text__tinymce, .edit-post-visual-editor h4.block-editor-block-list__block' => array( 'color' => esc_attr( $h4_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h5, .wp-block-heading h5.editor-rich-text__tinymce, .edit-post-visual-editor h5.block-editor-block-list__block' => array( 'color' => esc_attr( $h5_color ), ), '.editor-styles-wrapper .block-editor-block-list__block h6, .wp-block-heading h6.editor-rich-text__tinymce, .edit-post-visual-editor h6.block-editor-block-list__block' => array( 'color' => esc_attr( $h6_color ), ), ); if ( 'post' === get_post_type() ) { $colors_and_background_output['.editor-post-title__block .editor-post-title__input'] = array( 'color' => esc_attr( $single_post_title_color ), ); } $parse_css .= astra_parse_css( $colors_and_background_output ); $boxed_container = array(); $boxed_container_tablet = array(); $boxed_container_mobile = array(); $container_layout = get_post_meta( get_the_id(), 'site-content-layout', true ); if ( 'default' === $container_layout || '' === $container_layout ) { $container_layout = astra_get_option( 'single-' . get_post_type() . '-content-layout' ); if ( 'default' === $container_layout ) { $container_layout = astra_get_option( 'site-content-layout' ); } } if ( isset( $container_layout ) ) { $content_bg_obj = astra_get_option( 'content-bg-obj-responsive' ); // Setting up "Full-Width / Stretched" layout transparent but not for "Full-Width / Contained" in case of Max-Width site layout. // Because we showcase container with "Full-Width / Contained" layout, so it should be visible as it looks on frontend with their content background styles. $boxed_container = array( '.ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow' => array( 'padding' => '20px', ), ); $boxed_container_tablet = array( '.ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow' => array( 'padding' => '20px', ), ); $boxed_container_mobile = array( '.ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow' => array( 'padding' => '20px', ), ); if ( astra_addon_has_gcp_typo_preset_compatibility() ) { $boxed_container['.ast-separate-container .block-editor-writing-flow, .ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow'] = astra_get_responsive_background_obj( $content_bg_obj, 'desktop' ); $boxed_container_tablet['.ast-separate-container .block-editor-writing-flow, .ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow'] = astra_get_responsive_background_obj( $content_bg_obj, 'tablet' ); $boxed_container_mobile['.ast-separate-container .block-editor-writing-flow, .ast-max-width-layout.ast-plain-container .edit-post-visual-editor .block-editor-writing-flow'] = astra_get_responsive_background_obj( $content_bg_obj, 'mobile' ); } } $parse_css .= astra_parse_css( $boxed_container ); $parse_css .= astra_parse_css( $boxed_container_tablet, '', astra_addon_get_tablet_breakpoint() ); $parse_css .= astra_parse_css( $boxed_container_mobile, '', astra_addon_get_mobile_breakpoint() ); return $dynamic_css . $parse_css; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.6.2 | Introduced. |