* Added link to "go shopping" button

Onboarding - added a link to the shop page in the "go shopping" button

* Now using core's helper method

* Added esc_url function to shop_url

* woocommerce_get_page_id was replaced by wc_get_page_id
This commit is contained in:
Fernando 2020-02-14 14:24:31 -03:00 committed by GitHub
parent 33c5b41e3f
commit d0a557df96
1 changed files with 3 additions and 2 deletions

View File

@ -185,6 +185,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
* @return string Block content.
*/
private static function get_homepage_cover_block( $image ) {
$shop_url = get_permalink( wc_get_page_id( 'shop' ) );
if ( ! empty( $image['url'] ) && ! empty( $image['id'] ) ) {
return '<!-- wp:cover {"url":"' . esc_url( $image['url'] ) . '","id":' . intval( $image['id'] ) . '} -->
<div class="wp-block-cover has-background-dim" style="background-image:url(' . esc_url( $image['url'] ) . ')"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"' . __( 'Write title…', 'woocommerce-admin' ) . '","fontSize":"large"} -->
@ -196,7 +197,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
<!-- /wp:paragraph -->
<!-- wp:button {"align":"center"} -->
<div class="wp-block-button aligncenter"><a class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce-admin' ) . '</a></div>
<div class="wp-block-button aligncenter"><a href="' . esc_url( $shop_url ) . '" class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce-admin' ) . '</a></div>
<!-- /wp:button --></div></div>
<!-- /wp:cover -->';
}
@ -211,7 +212,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
<!-- /wp:paragraph -->
<!-- wp:button {"align":"center"} -->
<div class="wp-block-button aligncenter"><a class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce-admin' ) . '</a></div>
<div class="wp-block-button aligncenter"><a href="' . esc_url( $shop_url ) . '" class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce-admin' ) . '</a></div>
<!-- /wp:button --></div></div>
<!-- /wp:cover -->';
}