WordPress/wp-content/themes/twentytwenty/inc/block-patterns.php
desrosj 88cedeac5c Bundled Themes: Revert the [51372] update to block patterns in bundled themes.
Upon further examination, this change was not great for backwards compatibility, resulting in block validation errors when running on older versions of WordPress.

While there are currently many `console.info()` notices caused by older format block syntax being updated to the current version included in WordPress 5.8, the blocks do not break.

Block patterns do not currently have a versioning mechanism, or a means to indicate which versions of WordPress are supported.

See #53617.
Built from https://develop.svn.wordpress.org/trunk@51434


git-svn-id: http://core.svn.wordpress.org/trunk@51045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-14 20:02:59 +00:00

204 lines
9.7 KiB
PHP

<?php
/**
* Block Patterns
*
* @link https://developer.wordpress.org/reference/functions/register_block_pattern/
* @link https://developer.wordpress.org/reference/functions/register_block_pattern_category/
*
* @package WordPress
* @subpackage Twenty_Twenty
* @since Twenty Twenty 1.6
*/
/**
* Register Block Pattern Category.
*/
if ( function_exists( 'register_block_pattern_category' ) ) {
register_block_pattern_category(
'twentytwenty',
array( 'label' => esc_html__( 'Twenty Twenty', 'twentytwenty' ) )
);
}
/**
* Register Block Patterns.
*/
if ( function_exists( 'register_block_pattern' ) ) {
// Call to Action.
register_block_pattern(
'twentytwenty/call-to-action',
array(
'title' => esc_html__( 'Call to Action', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:group {"align":"wide","style":{"color":{"background":"#ffffff"}}} -->',
'<div class="wp-block-group alignwide has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:group -->',
'<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'Support the Museum and Get Exclusive Offers', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"align":"center"} -->',
'<p class="has-text-align-center">' . esc_html__( 'Members get access to exclusive exhibits and sales. Our memberships cost $99.99 and are billed annually.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:button {"align":"center","className":"is-style-outline"} -->',
'<div class="wp-block-button aligncenter is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Become a Member', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div></div>',
'<!-- /wp:group --></div></div>',
'<!-- /wp:group -->',
)
),
)
);
// Double Call to Action.
register_block_pattern(
'twentytwenty/double-call-to-action',
array(
'title' => esc_html__( 'Double Call to Action', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:columns {"align":"wide"} -->',
'<div class="wp-block-columns alignwide"><!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:group {"style":{"color":{"background":"#ffffff"}}} -->',
'<div class="wp-block-group has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'The Museum', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"align":"center"} -->',
'<p class="has-text-align-center">' . esc_html__( 'Award-winning exhibitions featuring internationally-renowned artists.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:buttons {"align":"center"} -->',
'<div class="wp-block-buttons aligncenter"><!-- wp:button {"className":"is-style-outline"} -->',
'<div class="wp-block-button is-style-outline"><a class="wp-block-button__link">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:buttons --></div></div>',
'<!-- /wp:group --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:group {"style":{"color":{"background":"#ffffff"}}} -->',
'<div class="wp-block-group has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'The Store', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"align":"center"} -->',
'<p class="has-text-align-center">' . esc_html__( 'An awe-inspiring collection of books, prints, and gifts from our exhibitions.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:buttons {"align":"center"} -->',
'<div class="wp-block-buttons aligncenter"><!-- wp:button {"className":"is-style-outline"} -->',
'<div class="wp-block-button is-style-outline"><a class="wp-block-button__link">' . esc_html__( 'Shop Now', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:buttons --></div></div>',
'<!-- /wp:group --></div>',
'<!-- /wp:column --></div>',
'<!-- /wp:columns -->',
)
),
)
);
// Event Details.
register_block_pattern(
'twentytwenty/event-details',
array(
'title' => esc_html__( 'Event Details', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:group {"align":"wide","backgroundColor":"primary"} -->',
'<div class="wp-block-group alignwide has-primary-background-color has-background"><div class="wp-block-group__inner-container"><!-- wp:columns -->',
'<div class="wp-block-columns"><!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
'<p class="has-text-align-center has-background-color has-text-color has-large-font-size">' . wp_kses_post( __( '<em>Dates</em><br>Aug 1 — Dec 1', 'twentytwenty' ) ) . '</p>',
'<!-- /wp:paragraph --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
'<p class="has-text-align-center has-background-color has-text-color has-large-font-size">' . wp_kses_post( __( '<em>Location</em><br>Exhibit Hall B', 'twentytwenty' ) ) . '</p>',
'<!-- /wp:paragraph --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:paragraph {"align":"center","textColor":"background","fontSize":"large"} -->',
'<p class="has-text-align-center has-background-color has-text-color has-large-font-size">' . wp_kses_post( __( '<em>Price</em><br>Included', 'twentytwenty' ) ) . '</p>',
'<!-- /wp:paragraph --></div>',
'<!-- /wp:column --></div>',
'<!-- /wp:columns --></div></div>',
'<!-- /wp:group -->',
)
),
)
);
// Featured Content.
register_block_pattern(
'twentytwenty/featured-content',
array(
'title' => esc_html__( 'Featured Content', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:columns {"align":"wide"} -->',
'<div class="wp-block-columns alignwide"><!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:image {"sizeSlug":"full"} -->',
'<figure class="wp-block-image size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/2020-three-quarters-1.png" alt="' . esc_attr__( 'Abstract Rectangles', 'twentytwenty' ) . '"/></figure>',
'<!-- /wp:image -->',
'<!-- wp:heading -->',
'<h2>' . esc_html__( 'Works and Days', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"fontSize":"larger"} -->',
'<p class="has-larger-font-size">' . esc_html__( 'August 1 — December 1', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:button {"align":"left","className":"is-style-outline"} -->',
'<div class="wp-block-button alignleft is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:column -->',
'<!-- wp:column -->',
'<div class="wp-block-column"><!-- wp:image {sizeSlug":"full"} -->',
'<figure class="wp-block-image size-full"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/2020-three-quarters-2.png" alt="' . esc_attr__( 'Abstract Rectangles', 'twentytwenty' ) . '"/></figure>',
'<!-- /wp:image -->',
'<!-- wp:heading -->',
'<h2>' . esc_html__( 'The Life I Deserve', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"fontSize":"larger"} -->',
'<p class="has-larger-font-size">' . esc_html__( 'August 1 — December 1', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
'<!-- wp:button {"align":"left","className":"is-style-outline"} -->',
'<div class="wp-block-button alignleft is-style-outline"><a class="wp-block-button__link" href="#">' . esc_html__( 'Read More', 'twentytwenty' ) . '</a></div>',
'<!-- /wp:button --></div>',
'<!-- /wp:column --></div>',
'<!-- /wp:columns -->',
)
),
)
);
// Introduction.
register_block_pattern(
'twentytwenty/introduction',
array(
'title' => esc_html__( 'Introduction', 'twentytwenty' ),
'categories' => array( 'twentytwenty' ),
'viewportWidth' => 1400,
'content' => implode(
'',
array(
'<!-- wp:heading {"align":"center"} -->',
'<h2 class="has-text-align-center">' . esc_html__( 'The Premier Destination for Modern Art in Sweden', 'twentytwenty' ) . '</h2>',
'<!-- /wp:heading -->',
'<!-- wp:paragraph {"dropCap":true} -->',
'<p class="has-drop-cap">' . esc_html__( 'With seven floors of striking architecture, UMoMA shows exhibitions of international contemporary art, sometimes along with art historical retrospectives. Existential, political, and philosophical issues are intrinsic to our program. As visitor, you are invited to guided tours artist talks, lectures, film screenings, and other events with free admission.', 'twentytwenty' ) . '</p>',
'<!-- /wp:paragraph -->',
)
),
)
);
}