woocommerce/plugins/woocommerce-blocks/patterns/hero-product-split.php

38 lines
1.7 KiB
PHP
Raw Normal View History

<?php
/**
Consistent Pattern Titles (https://github.com/woocommerce/woocommerce-blocks/pull/9814) * Update featured-category-cover-image.php * Update featured-category-focus.php * Update featured-category-triple.php * Update featured-products-5-cols.php * Update filters.php * Update footer-large-dark.php * Update footer-large.php * Update footer-simple-dark.php * Update footer-simple.php * Update footer-simple-menu-and-cart.php * Update footer-with-2-menus-dark.php * Update footer-with-2-menus.php * Update footer-with-3-menus.php * Update header-centered-search-pattern.php * Update header-essential-dark.php * Update header-essential.php * Update header-large-dark.php * Update header-large.php * Update header-minimal.php * Update hero-product-3-split.php * Update hero-product-chessboard.php * Update hero-product-split.php * Update just-arrived-full-hero.php * Update no-products-found.php * Update product-collections-featured-collection.php * Update product-collections-featured-collections.php * Update product-collections-newest-arrivals.php * Update product-details-listing.php * Update product-details-pattern.php * Update product-featured-2-columns.php * Update product-hero-2-col-2-row.php * Update product-hero.php * Update product-listing-with-gallery-and-description.php * Update product-query-1-1-image-4-column-products-row.php * Update product-query-3-column-product-row.php * Update product-query-4-column-product-row.php * Update product-query-large-image-product-gallery.php * Update product-query-minimal-5-column-products-row.php * Update product-query-minimal-product-list.php * Update product-query-product-gallery.php * Update product-query-product-list-with-1-1-images.php * Update product-query-product-list-with-full-product-description.php * Update product-search-form.php * Update shop-by-price.php * Update store-info-alt-image-and-text.php * Update testimonials-3-columns.php * Update testimonials-single.php * Create readme.md * Update featured-category-cover-image.php * Update featured-category-focus.php * Update featured-category-triple.php * Update featured-products-5-cols.php * Update filters.php * Update footer-large-dark.php * Update footer-large.php * Update testimonials-single.php * Update testimonials-3-columns.php * Update store-info-alt-image-and-text.php * Update shop-by-price.php * Update readme.md * Update product-search-form.php * Update product-query-product-list-with-full-product-description.php * Update product-query-product-list-with-1-1-images.php * Update product-query-product-gallery.php * Update product-query-minimal-product-list.php * Update footer-simple-dark.php * Update footer-simple-menu-and-cart.php * Update footer-simple.php * Update footer-with-2-menus-dark.php * Update footer-with-2-menus.php * Update footer-with-3-menus.php * Update product-query-minimal-5-column-products-row.php * Update product-query-large-image-product-gallery.php * Update product-query-4-column-product-row.php * Update product-query-3-column-product-row.php * Update product-query-1-1-image-4-column-products-row.php * Update product-listing-with-gallery-and-description.php * Update product-hero.php * Update product-hero-2-col-2-row.php * Update product-featured-2-columns.php * Update product-details-pattern.php * Update product-details-listing.php * Update product-collections-newest-arrivals.php * Update product-collections-featured-collections.php * Update product-collections-featured-collection.php * Update no-products-found.php * Update just-arrived-full-hero.php * Update hero-product-split.php * Update hero-product-chessboard.php * Update hero-product-3-split.php * Update header-minimal.php * Update header-large.php * Update header-large-dark.php * Update header-essential.php * Update header-essential-dark.php * Update header-centered-search-pattern.php * Update readme.md * Update and rename readme.md to README.md * Update patterns/README.md Co-authored-by: Karol Manijak <karol.manijak@automattic.com> --------- Co-authored-by: Karol Manijak <karol.manijak@automattic.com> Co-authored-by: Niels Lange <info@nielslange.de>
2023-06-21 07:50:12 +00:00
* Title: Hero Product Split
* Slug: woocommerce-blocks/hero-product-split
* Categories: WooCommerce
*/
[Store Customization] Update patterns to use the AI selected verticals for images (https://github.com/woocommerce/woocommerce-blocks/pull/10796) * Add the Verticals API client * Add tests * Refactor error handling * Create first version of the prompt class * Improve Vertical selector and add tests * Remove testing code * Update class comment * Add PatternImages class * Pass the dictionary as param * Add tests * Add `get_pattern_images` function and use it on patterns * Add the Jetpack Connection Package as a dependency for WooCommerce Blocks. * Introduce the new Configuration Class for registering and enabling the Jetpack connection for sites and users. * Introduce the Connection class for making requests to the GPT AI API. * Update the get_jwt_token method. * Update the error messages for the get_jwt_token method. * Update the register_site method. * Update the Configuration class structure and add Dependency Injection. * Update structure for the Connection Class. * Update the return type for the get_jwt_token method. * Update method visibility for get_site_id * Update the name and params for methods within the Connection Class * Add tests for the Connecction class. * Update the Constructor for the Configuration class. * Add the Patterns class. * Move the get_image_url function to the PatternImages class and update the call in all patterns to address errors. * Remove the functions.php file * Update the VerticalsSelector class. * Update the constructor for PatternImages. * Update the Store API Route for Patterns. * Update the create_patterns_content method to ensure it returns the results of update_option. * Add the new Patterns route to the RoutesController class. * Update the route path and remove the business description validation as that is done via create_patterns_content * Introduce the PatternsSchema * Update the prompt, errors messages and output format for the Verticals Selector. * Fix the missing file error for the Patterns Dictionary. * Introduce the new get_patterns_dictionary method and update the create_patterns_content method to better handle errors. * Update the returned response for the endpoint. * Add the get_item_response method to the PatternsSchema class. * Update response for when allow_ai_connection option is not set. * Enable authentication for the endpoint. * Modify and temporarily remove some failing tests for the AI API: a separate PR will be opened to clear those out later. * Add validation to the verticals_id. * Remove reference to the src/Patterns/functions.php file. * Update `alt` to be more generic, since the displayed images will vary * Store Customization > Schedule an action to update the patterns content whenever the business description is changed (https://github.com/woocommerce/woocommerce-blocks/pull/10956) * Introduce the new OptionUpdate class. * Update the path to action schduler and add a file_exists check before attempting to schedule the action. * Update the content in patterns from the BlockPatterns class instead. * Remove return comment --------- Co-authored-by: Alba Rincón <alba.rincon@automattic.com> --------- Co-authored-by: Patricia Hillebrandt <patriciahillebrandt@gmail.com>
2023-09-19 07:05:44 +00:00
use Automattic\WooCommerce\Blocks\Patterns\PatternsHelper;
$content = PatternsHelper::get_pattern_content( 'woocommerce-blocks/hero-product-split' );
$images = PatternsHelper::get_pattern_images( 'woocommerce-blocks/hero-product-split' );
$hero_title = $content['titles'][0]['default'] ?? '';
?>
<!-- wp:media-text {"align":"full","mediaPosition":"right","mediaType":"image","mediaSizeSlug":"full","imageFill":false} -->
<div class="wp-block-media-text alignfull has-media-on-the-right is-stacked-on-mobile">
<div class="wp-block-media-text__content">
<!-- wp:heading -->
<h2 class="wp-block-heading"><?php echo esc_html( $hero_title ); ?></h2>
<!-- /wp:heading -->
<!-- wp:buttons {"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|40"}}}} -->
<div class="wp-block-buttons" style="margin-bottom:var(--wp--preset--spacing--40)">
<!-- wp:button -->
<div class="wp-block-button">
<a href="<?php echo esc_url( get_permalink( wc_get_page_id( 'shop' ) ) ); ?>" class="wp-block-button__link wp-element-button"><?php esc_html_e( 'Shop now', 'woo-gutenberg-products-block' ); ?></a>
</div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
<figure class="wp-block-media-text__media">
<img src="<?php echo esc_url( PatternsHelper::get_image_url( $images, 0, 'images/pattern-placeholders/pattern-fashion-clothing-outerwear-wool-scarf.png' ) ); ?>" alt="<?php esc_attr_e( 'Placeholder image used to represent a product being showcased in a hero section.', 'woo-gutenberg-products-block' ); ?>" />
</figure>
</div>
<!-- /wp:media-text -->