From 10bc2969b6b5b51d28b1d721f3dd0865b079c275 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Tue, 27 Aug 2024 16:10:02 +0530 Subject: [PATCH] Add function to retrieve font style, theme font slugs --- includes/Services/FlowService.php | 14 ++++++++++---- includes/Themes/Fonts.php | 12 ++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/includes/Services/FlowService.php b/includes/Services/FlowService.php index 2271c68..c4ffe84 100644 --- a/includes/Services/FlowService.php +++ b/includes/Services/FlowService.php @@ -443,14 +443,20 @@ public static function get_onboarding_coming_soon() { /** * Retrieves the selected header template part. * - * This function reads data from the WordPress options and returns the selected - * header template part if it exists. If the header template part is not set, - * it returns null. - * * @return string|null The selected header template part or null if not set. */ public static function get_selected_header_template_part() { $data = self::read_data_from_wp_option( false ); return ( ! empty( $data['data']['partHeader'] ) ) ? $data['data']['partHeader'] : null; } + + /** + * Retrieves the selected font style. + * + * @return string|null The selected font style or null if not set. + */ + public static function get_selected_font_style() { + $data = self::read_data_from_wp_option( false ); + return ( ! empty( $data['data']['fontStyle'] ) ) ? $data['data']['fontStyle'] : null; + } } diff --git a/includes/Themes/Fonts.php b/includes/Themes/Fonts.php index 6c8c562..7107cb9 100644 --- a/includes/Themes/Fonts.php +++ b/includes/Themes/Fonts.php @@ -20,6 +20,7 @@ protected static function get_theme_fonts() { 'modern-approachable' => array( 'label' => __( 'Modern & approachable', 'wp-module-onboarding-data' ), 'matches' => 'yith-wonder/theme-json', + 'slugs' => array( 'mulish', 'poppins' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--mulish)', @@ -36,6 +37,7 @@ protected static function get_theme_fonts() { 'strong-sleek' => array( 'label' => __( 'Strong & sleek', 'wp-module-onboarding-data' ), 'matches' => 'yith-wonder/styles/01-blue-shades', + 'slugs' => array( 'raleway', 'oswald' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--raleway)', @@ -52,6 +54,7 @@ protected static function get_theme_fonts() { 'stately-elevated' => array( 'label' => __( 'Stately & elevated', 'wp-module-onboarding-data' ), 'matches' => 'yith-wonder/styles/02-pink-shades', + 'slugs' => array( 'source-sans-pro', 'playfair' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--source-sans-pro)', @@ -68,6 +71,7 @@ protected static function get_theme_fonts() { 'typewriter-crisp-midcentury' => array( 'label' => __( 'Typewriter & crisp midcentury', 'wp-module-onboarding-data' ), 'matches' => 'yith-wonder/styles/03-orange-shades', + 'slugs' => array( 'jost', 'solway' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--jost)', @@ -84,6 +88,7 @@ protected static function get_theme_fonts() { 'refined-traditional-newsletter' => array( 'label' => __( 'Refined traditional newsletter', 'wp-module-onboarding-data' ), 'matches' => 'yith-wonder/styles/04-black-shades', + 'slugs' => array( 'jost', 'merriweather' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--jost)', @@ -100,6 +105,7 @@ protected static function get_theme_fonts() { 'bold-stamp-slab' => array( 'label' => __( 'Bold stamp & slab', 'wp-module-onboarding-data' ), 'matches' => 'yith-wonder/styles/05-red-shades', + 'slugs' => array( 'changa-one', 'roboto-slab' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--roboto-slab)', @@ -116,6 +122,7 @@ protected static function get_theme_fonts() { 'fast-simple' => array( 'label' => __( 'Fast & Simple', 'wp-module-onboarding-data' ), 'matches' => 'newfold/onboarding-01', + 'slugs' => array( 'system' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--system)', @@ -132,6 +139,7 @@ protected static function get_theme_fonts() { 'timeless-traditional' => array( 'label' => __( 'Timeless & Traditional', 'wp-module-onboarding-data' ), 'matches' => 'newfold/onboarding-02', + 'slugs' => array( 'serif' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--serif)', @@ -148,6 +156,7 @@ protected static function get_theme_fonts() { 'sleek-sophisticated' => array( 'label' => __( 'Sleek & Sophisticated', 'wp-module-onboarding-data' ), 'matches' => 'newfold/onboarding-03', + 'slugs' => array( 'dm-sans' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--dm-sans)', @@ -164,6 +173,7 @@ protected static function get_theme_fonts() { 'clear-crisp' => array( 'label' => __( 'Clear & Crisp', 'wp-module-onboarding-data' ), 'matches' => 'newfold/onboarding-04', + 'slugs' => array( 'inter' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--inter)', @@ -180,6 +190,7 @@ protected static function get_theme_fonts() { 'retro-classy' => array( 'label' => __( 'Retro & Classy', 'wp-module-onboarding-data' ), 'matches' => 'newfold/onboarding-05', + 'slugs' => array( 'league-spartan' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--league-spartan)', @@ -196,6 +207,7 @@ protected static function get_theme_fonts() { 'defined-solid' => array( 'label' => __( 'Defined & Solid', 'wp-module-onboarding-data' ), 'matches' => 'newfold/onboarding-06', + 'slugs' => array( 'roboto-slab' ), 'styles' => array( 'typography' => array( 'fontFamily' => 'var(--wp--preset--font-family--roboto-slab)',