Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper Functions and Slugs for Interacting with Flow and Theme Data #111

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions includes/Services/FlowService.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,4 +439,24 @@ public static function get_onboarding_coming_soon() {
$data = self::read_data_from_wp_option( false );
return isset( $data['data']['comingSoon'] ) ? $data['data']['comingSoon'] : null;
}

/**
* Retrieves the selected header template part.
*
* @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;
}
}
19 changes: 19 additions & 0 deletions includes/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,23 @@ public static function get_flow_default_theme_slug( $flow ) {
public static function get_active_theme() {
return ( \wp_get_theme() )->get( 'TextDomain' );
}

/**
* Retrieves the selected DIY theme settings.
*
* @return mixed The stored DIY theme settings, or false if the option does not exist.
*/
public static function get_selected_diy_theme_settings() {
return get_option( Options::get_option_name( 'theme_settings' ) );
}

/**
* Updates the DIY theme settings.
*
* @param array $settings The new theme settings to store.
* @return bool True if the option value has changed, false if not or if an error occurred.
*/
public static function set_diy_theme_settings( $settings ) {
return update_option( Options::get_option_name( 'theme_settings' ), $settings );
}
}
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' ),
arunshenoy99 marked this conversation as resolved.
Show resolved Hide resolved
'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
Loading