diff --git a/composer.json b/composer.json index 37535d4c1..45a6708f9 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "mustache/mustache": "^2.14", "wp-cli/wp-config-transformer": "^1.3", "newfold-labs/wp-module-onboarding-data": "^0.0.5", - "newfold-labs/wp-module-patterns": "^0.1.6" + "newfold-labs/wp-module-patterns": "^0.1.8" }, "require-dev": { "wp-phpunit/wp-phpunit": "^6.2", diff --git a/composer.lock b/composer.lock index 5cf771ac3..fb193f4ff 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e37f836e590b3ffc1d57912ba2ccaf9f", + "content-hash": "fdaf3826bf3ee770558a8c31917dc53f", "packages": [ { "name": "mustache/mustache", @@ -190,16 +190,16 @@ }, { "name": "newfold-labs/wp-module-patterns", - "version": "0.1.6", + "version": "0.1.8", "source": { "type": "git", "url": "https://github.com/newfold-labs/wp-module-patterns.git", - "reference": "3a446d1923c6c9bee13d86d0fda4cc4585742959" + "reference": "8e582216003d1e881b851efa76230ce0237d7fd4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/newfold-labs/wp-module-patterns/zipball/3a446d1923c6c9bee13d86d0fda4cc4585742959", - "reference": "3a446d1923c6c9bee13d86d0fda4cc4585742959", + "url": "https://api.github.com/repos/newfold-labs/wp-module-patterns/zipball/8e582216003d1e881b851efa76230ce0237d7fd4", + "reference": "8e582216003d1e881b851efa76230ce0237d7fd4", "shasum": "" }, "require-dev": { @@ -233,10 +233,10 @@ ], "description": "WordPress Cloud Patterns", "support": { - "source": "https://github.com/newfold-labs/wp-module-patterns/tree/0.1.6", + "source": "https://github.com/newfold-labs/wp-module-patterns/tree/0.1.8", "issues": "https://github.com/newfold-labs/wp-module-patterns/issues" }, - "time": "2023-10-16T19:35:02+00:00" + "time": "2023-10-24T20:40:31+00:00" }, { "name": "wp-cli/wp-config-transformer", diff --git a/includes/RestApi/Themes/ThemeGeneratorController.php b/includes/RestApi/Themes/ThemeGeneratorController.php index 4c3e8d67a..503c89a74 100644 --- a/includes/RestApi/Themes/ThemeGeneratorController.php +++ b/includes/RestApi/Themes/ThemeGeneratorController.php @@ -6,6 +6,7 @@ use NewfoldLabs\WP\Module\Onboarding\Mustache\Mustache; use NewfoldLabs\WP\Module\Onboarding\Data\Themes; use NewfoldLabs\WP\Module\Onboarding\Data\Options; +use NewfoldLabs\WP\Module\Onboarding\Data\Patterns; /** * Class ThemeGeneratorController @@ -130,6 +131,13 @@ public function generate_child_theme() { } } + if ( $flow_data['partFooter'] ) { + $part_patterns['footer'] = $this->generate_theme_part_pattern( $flow_data['partFooter'] ); + if ( \is_wp_error( $part_patterns['footer'] ) ) { + return $part_patterns['footer']; + } + } + $child_theme_stylesheet_comment = $this->generate_child_theme_stylesheet_comment( $parent_theme_slug, $child_theme_slug ); // Write the child theme to the filesystem under themes. @@ -295,7 +303,7 @@ private function generate_child_theme_stylesheet_comment( $parent_theme_slug, $c * @return string|\WP_Error the pattern for the part. */ private function generate_theme_part_pattern( $pattern_slug ) { - $pattern = \WP_Block_Patterns_Registry::get_instance()->get_registered( $pattern_slug ); + $pattern = Patterns::get_pattern_from_slug( $pattern_slug ); if ( ! $pattern ) { return new \WP_Error( 'nfd_onboarding_pattern_not_registered', diff --git a/src/OnboardingSPA/components/Drawer/DrawerPanel/DesignHeaderMenu.js b/src/OnboardingSPA/components/Drawer/DrawerPanel/DesignHeaderMenu.js index 51daa932f..d21eb4342 100644 --- a/src/OnboardingSPA/components/Drawer/DrawerPanel/DesignHeaderMenu.js +++ b/src/OnboardingSPA/components/Drawer/DrawerPanel/DesignHeaderMenu.js @@ -48,6 +48,7 @@ const DesignHeaderMenu = () => { } const headerMenuPatterns = headerMenuPreviewResponse?.body.pageHeaders; + const footerPattern = headerMenuPreviewResponse?.body.pageFooter; const pageContent = headerMenuPreviewResponse?.body.pageBody; if ( @@ -57,6 +58,14 @@ const DesignHeaderMenu = () => { currentData.data.partHeader = headerMenuPatterns[ 0 ].slug; setCurrentOnboardingData( currentData ); } + + if ( + ! currentData.data?.partFooter || + currentData.data?.partFooter === '' + ) { + currentData.data.partFooter = footerPattern.slug; + setCurrentOnboardingData( currentData ); + } setSelectedPattern( currentData.data.partHeader ); setHeaderMenuPreviewData( headerMenuPreviewResponse.body ); setPatterns( headerMenuPatterns );