Skip to content

Commit

Permalink
Add function to retrieve font style, theme font slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
arunshenoy99 committed Aug 27, 2024
1 parent 4913f36 commit 10bc296
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 10 additions & 4 deletions includes/Services/FlowService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
12 changes: 12 additions & 0 deletions includes/Themes/Fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand Down

0 comments on commit 10bc296

Please sign in to comment.