$this->parse_element_style( $post, $element ), 10, 2 ); } private function parse_element_style( Post $post, Element_Base $element ) { if ( ! ( $element instanceof Atomic_Widget_Base || $element instanceof Atomic_Element_Base ) || Post::class !== get_class( $post ) ) { return; } $styles = $element->get_raw_data()['styles']; if ( empty( $styles ) ) { return; } $this->styles_enqueue_fonts( $styles ); $css = Styles_Renderer::make( [ 'breakpoints' => Plugin::$instance->breakpoints->get_breakpoints_config(), ] )->render( $styles ); $post->get_stylesheet()->add_raw_css( $css ); } /** * @param array, * meta: array * }> * }> $styles */ private function styles_enqueue_fonts( array $styles ): void { foreach ( $styles as $style ) { foreach ( $style['variants'] as $variant ) { if ( isset( $variant['props']['font-family'] ) ) { Plugin::$instance->frontend->enqueue_font( $variant['props']['font-family'] ); } } } } }