-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spin off from #29890 for simple blocks without InnerBlocks
- Loading branch information
1 parent
e94c993
commit 71a8544
Showing
10 changed files
with
618 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
<?php | ||
/** | ||
* Block patterns registration. | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
// Test patterns for transform scope. This file will be deleted before merge. | ||
|
||
// Single block pattens with different attributes. | ||
// Paragraph patterns. | ||
register_block_pattern( | ||
'paragraph/v1', | ||
array( | ||
'title' => __( 'Paragraph version 1', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/paragraph' ), | ||
), | ||
'content' => '<!-- wp:paragraph {"dropCap":true,"backgroundColor":"orange"} --> | ||
<p class="has-drop-cap has-orange-background-color has-background">Hello my paragraph!</p> | ||
<!-- /wp:paragraph -->', | ||
) | ||
); | ||
register_block_pattern( | ||
'paragraph/v2', | ||
array( | ||
'title' => __( 'Paragraph version 2', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/paragraph' ), | ||
), | ||
'content' => '<!-- wp:paragraph {"align":"center","backgroundColor":"gray","textColor":"green","fontSize":"extra-large"} --> | ||
<p class="has-text-align-center has-green-color has-gray-background-color has-text-color has-background has-extra-large-font-size">Hello my paragraph!</p> | ||
<!-- /wp:paragraph -->', | ||
) | ||
); | ||
|
||
// Multi block transform patterns. | ||
register_block_pattern( | ||
'multi/v2', | ||
array( | ||
'title' => __( 'Multi blocks v2 - deep nesting', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/paragraph', 'core/heading' ), | ||
), | ||
'content' => '<!-- wp:group --> | ||
<div class="wp-block-group"><div class="wp-block-group__inner-container"> | ||
<!-- wp:heading {"fontSize":"large"} --> | ||
<h2 class="has-large-font-size"><span style="color:#ba0c49" class="has-inline-color"><strong>2</strong>.</span>Which treats of the first sally the ingenious Don Quixote made from home</h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:group --> | ||
<div class="wp-block-group"><div class="wp-block-group__inner-container"> | ||
<!-- wp:paragraph --> | ||
<p>These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge.</p> | ||
<!-- /wp:paragraph --> | ||
</div></div> | ||
<!-- /wp:group --> | ||
<!-- wp:heading {"backgroundColor":"purple"} --> | ||
<h2 class="has-purple-background-color has-background">Pattern Heading</h2> | ||
<!-- /wp:heading --> | ||
</div></div> | ||
<!-- /wp:group -->', | ||
) | ||
); | ||
register_block_pattern( | ||
'multi/v1', | ||
array( | ||
'title' => __( 'Multi blocks v1', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/paragraph', 'core/heading' ), | ||
), | ||
'content' => '<!-- wp:group --> | ||
<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:heading {"fontSize":"large"} --> | ||
<h2 class="has-large-font-size"><span style="color:#ba0c49" class="has-inline-color"><strong>2</strong>.</span>Which treats of the first sally the ingenious Don Quixote made from home</h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:paragraph --> | ||
<p>These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge.</p> | ||
<!-- /wp:paragraph --></div></div> | ||
<!-- /wp:group -->', | ||
) | ||
); | ||
|
||
// Template Parts Patterns. | ||
// Headers. | ||
register_block_pattern( | ||
'header/v1', | ||
array( | ||
'title' => __( 'Header v1', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/template-part/header' ), | ||
), | ||
'content' => ' | ||
<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"center"} --> | ||
<!-- wp:page-list /--> | ||
<!-- /wp:navigation --> | ||
<!-- wp:columns {"align":"wide"} --> | ||
<div class="wp-block-columns alignwide"> | ||
<!-- wp:column --> | ||
<div class="wp-block-column"><!-- wp:site-title /--></div> | ||
<!-- /wp:column --> | ||
<!-- wp:column --> | ||
<div class="wp-block-column"><!-- wp:site-tagline /--></div> | ||
<!-- /wp:column --> | ||
</div> | ||
<!-- /wp:columns -->', | ||
) | ||
); | ||
register_block_pattern( | ||
'header/v2', | ||
array( | ||
'title' => __( 'Header v2', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/template-part/header' ), | ||
), | ||
'content' => ' | ||
<!-- wp:heading {"textAlign":"center","backgroundColor":"gray","textColor":"yellow"} --> | ||
<h2 class="has-text-align-center has-yellow-color has-gray-background-color has-text-color has-background">This is the Header</h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:columns {"align":"wide"} --> | ||
<div class="wp-block-columns alignwide"><!-- wp:column --> | ||
<div class="wp-block-column"><!-- wp:site-title /--></div> | ||
<!-- /wp:column --> | ||
<!-- wp:column --> | ||
<div class="wp-block-column"> | ||
<!-- wp:site-tagline /--> | ||
</div> | ||
<!-- /wp:column --></div> | ||
<!-- /wp:columns -->', | ||
) | ||
); | ||
register_block_pattern( | ||
'footer/v1', | ||
array( | ||
'title' => __( 'Footer v1', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/template-part/footer' ), | ||
), | ||
'content' => ' | ||
<!-- wp:heading {"textAlign":"center","backgroundColor":"gray","textColor":"yellow"} --> | ||
<h2 class="has-text-align-center has-yellow-color has-gray-background-color has-text-color has-background">This is a Footer</h2> | ||
<!-- /wp:heading --> | ||
<!-- wp:columns {"align":"wide"} --> | ||
<div class="wp-block-columns alignwide"><!-- wp:column --> | ||
<div class="wp-block-column"><!-- wp:paragraph --> | ||
<p><a href="mailto:#">example@example.com<br></a>T. +00 (0)1 22 33 44 55</p> | ||
<!-- /wp:paragraph --></div> | ||
<!-- /wp:column --> | ||
<!-- wp:column --> | ||
<div class="wp-block-column"><!-- wp:paragraph {"align":"center"} --> | ||
<p class="has-text-align-center">2, Rue Losuis-Boilly<br>Paris, France</p> | ||
<!-- /wp:paragraph --></div> | ||
<!-- /wp:column --> | ||
<!-- wp:column {"verticalAlignment":"center"} --> | ||
<div class="wp-block-column is-vertically-aligned-center"><!-- wp:social-links {"align":"right","className":"is-style-twentytwentyone-social-icons-color"} --> | ||
<ul class="wp-block-social-links alignright is-style-twentytwentyone-social-icons-color"><!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /--> | ||
<!-- wp:social-link {"url":"https://www.facebook.com/WordPress/","service":"facebook"} /--> | ||
<!-- wp:social-link {"url":"https://twitter.com/WordPress","service":"twitter"} /--> | ||
<!-- wp:social-link {"url":"https://www.youtube.com/wordpress","service":"youtube"} /--></ul> | ||
<!-- /wp:social-links --></div> | ||
<!-- /wp:column --></div> | ||
<!-- /wp:columns -->', | ||
) | ||
); | ||
|
||
|
||
// Tests with InnerBlocks like Buttons. | ||
register_block_pattern( | ||
'buttons/rigas', | ||
array( | ||
'title' => __( 'Buttons v1', 'gutenberg' ), | ||
'scope' => array( | ||
'inserter' => false, | ||
'transform' => array( 'core/buttons' ), | ||
), | ||
'content' => '<!-- wp:columns --> | ||
<div class="wp-block-columns"><!-- wp:column --> | ||
<div class="wp-block-column"><!-- wp:buttons {"contentJustification":"center","orientation":"vertical"} --> | ||
<div class="wp-block-buttons is-content-justification-center is-vertical"><!-- wp:button --> | ||
<div class="wp-block-button"><a class="wp-block-button__link">Hello</a></div> | ||
<!-- /wp:button --> | ||
<!-- wp:button {"style":{"color":{"background":"#4acbc3"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link has-background" style="background-color:#4acbc3">Buttons</a></div> | ||
<!-- /wp:button --></div> | ||
<!-- /wp:buttons --></div> | ||
<!-- /wp:column --> | ||
<!-- wp:column --> | ||
<div class="wp-block-column"><!-- wp:buttons {"contentJustification":"center","orientation":"vertical"} --> | ||
<div class="wp-block-buttons is-content-justification-center is-vertical"><!-- wp:button {"style":{"color":{"background":"#229fd5"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link has-background" style="background-color:#229fd5">Scoped</a></div> | ||
<!-- /wp:button --> | ||
<!-- wp:button {"style":{"color":{"background":"#ce9ddf"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link has-background" style="background-color:#ce9ddf">Pattern</a></div> | ||
<!-- /wp:button --></div> | ||
<!-- /wp:buttons --></div> | ||
<!-- /wp:column --></div> | ||
<!-- /wp:columns -->', | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.