diff --git a/lib/block-patterns.php b/lib/block-patterns.php index 789f483aea6c34..3c3695d4ac049a 100644 --- a/lib/block-patterns.php +++ b/lib/block-patterns.php @@ -159,6 +159,7 @@ 'paragraph/large-with-background-color', array( 'title' => __( 'Large Paragraph with background color', 'gutenberg' ), + 'categories' => array( 'Text' ), 'blockTypes' => array( 'core/paragraph' ), 'viewportWidth' => 500, 'content' => ' @@ -170,6 +171,7 @@ 'social-links/shared-background-color', array( 'title' => __( 'Social links with a shared background color', 'gutenberg' ), + 'categories' => array( 'Buttons' ), 'blockTypes' => array( 'core/social-links' ), 'viewportWidth' => 500, 'content' => ' @@ -179,3 +181,64 @@ ', ) ); + +// Deactivate the legacy patterns bundled with WordPress, and add new block patterns for testing. +// More details in the trac issue (https://core.trac.wordpress.org/ticket/52846). +add_action( + 'init', + function() { + + $core_block_patterns = array( + 'text-two-columns', + 'two-buttons', + 'two-images', + 'text-two-columns-with-images', + 'text-three-columns-buttons', + 'large-header', + 'large-header-button', + 'three-buttons', + 'heading-paragraph', + 'quote', + ); + + $new_core_block_patterns = array( + 'media-text-nature', + 'two-images-gallery', + 'three-columns-media-text', + 'quote', + 'large-header-left', + 'large-header-text-button', + 'media-text-art', + 'text-two-columns-title', + 'three-columns-text', + 'text-two-columns-title-offset', + 'heading', + 'three-images-gallery', + 'text-two-columns', + 'media-text-arquitecture', + 'two-buttons', + ); + + if ( ! function_exists( 'unregister_block_pattern' ) ) { + return; + } + + foreach ( $core_block_patterns as $core_block_pattern ) { + unregister_block_pattern( 'core/' . $core_block_pattern ); + } + + register_block_pattern_category( 'buttons', array( 'label' => _x( 'Buttons', 'Block pattern category', 'default' ) ) ); + register_block_pattern_category( 'columns', array( 'label' => _x( 'Columns', 'Block pattern category', 'default' ) ) ); + register_block_pattern_category( 'header', array( 'label' => _x( 'Headers', 'Block pattern category', 'default' ) ) ); + register_block_pattern_category( 'gallery', array( 'label' => _x( 'Gallery', 'Block pattern category', 'default' ) ) ); + register_block_pattern_category( 'text', array( 'label' => _x( 'Text', 'Block pattern category', 'default' ) ) ); + + foreach ( $new_core_block_patterns as $core_block_pattern ) { + register_block_pattern( + 'core/' . $core_block_pattern, + require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php' + ); + } + + } +); diff --git a/lib/block-patterns/heading.php b/lib/block-patterns/heading.php new file mode 100644 index 00000000000000..571ff91fa36c4a --- /dev/null +++ b/lib/block-patterns/heading.php @@ -0,0 +1,16 @@ + _x( 'Heading', 'Block pattern title', 'default' ), + 'categories' => array( 'text' ), + 'blockTypes' => array( 'core/heading' ), + 'content' => ' +
' . esc_html__( 'Even a child knows how valuable the forest is. The fresh, breathtaking smell of trees. Echoing birds flying above that dense magnitude. A stable climate, a sustainable diverse life and a source of culture. Yet, forests and other ecosystems hang in the balance, threatened to become croplands, pasture, and plantations.', 'default' ) . '
+' . wp_kses_post( __( 'An exhibition about the different representations of the ocean throughout time, between the sixteenth and the twentieth century. Taking place in our Open Room in Floor 2.', 'default' ) ) . '
+ + + + +' . esc_html__( 'Eleanor Harris (American, 1901-1942)', 'default' ) . '
+' . esc_html__( 'Trees are more important today than ever before. More than 10,000 products are reportedly made from trees. Through chemistry, the humble woodpile is yielding chemicals, plastics and fabrics that were beyond comprehension when an axe first felled a Texas tree.', 'default' ) . '
+ + + ++ + + +' . esc_html__( "\"Contributing makes me feel like I'm being useful to the planet.\"", 'default' ) . '
' . wp_kses_post( __( '— Anna Wong, Volunteer', 'default' ) ) . '
' . esc_html__( 'Oceanic Inspiration', 'default' ) . '
+' . esc_html__( 'Winding veils round their heads, the women walked on deck. They were now moving steadily down the river, passing the dark shapes of ships at anchor, and London was a swarm of lights with a pale yellow canopy drooping above it. There were the lights of the great theatres, the lights of the long streets, lights that indicated huge squares of domestic comfort, lights that hung high in air.', 'default' ) . '
+' . esc_html__( 'No darkness would ever settle upon those lamps, as no darkness had settled upon them for hundreds of years. It seemed dreadful that the town should blaze for ever in the same spot; dreadful at least to people going away to adventure upon the sea, and beholding it as a circumscribed mound, eternally burnt, eternally scarred. From the deck of the ship the great city appeared a crouched and cowardly figure, a sedentary miser.', 'default' ) . '
+' . esc_html__( 'They followed her on to the deck. All the smoke and the houses had disappeared, and the ship was out in a wide space of sea very fresh and clear though pale in the early light. They had left London sitting on its mud. A very thin line of shadow tapered on the horizon, scarcely thick enough to stand the burden of Paris, which nevertheless rested upon it. They were free of roads, free of mankind, and the same exhilaration at their freedom ran through them all.', 'default' ) . '
+' . esc_html__( "The ship was making her way steadily through small waves which slapped her and then fizzled like effervescing water, leaving a little border of bubbles and foam on either side. The colourless October sky above was thinly clouded as if by the trail of wood-fire smoke, and the air was wonderfully salt and brisk. Indeed it was too cold to stand still. Mrs. Ambrose drew her arm within her husband's, and as they moved off it could be seen from the way in which her sloping cheek turned up to his that she had something private to communicate.", 'default' ) . '
+' . esc_html__( 'We have worked with:', 'default' ) . '
+ + + +' . wp_kses_post( __( 'EARTHFUND™
ARCHWEEKLY
FUTURE ROADS
BUILDING NY', 'default' ) ) . '
' . esc_html__( 'Positive growth.', 'default' ) . '
+ + +' . wp_kses_post( __( 'Nature, in the common sense, refers to essences unchanged by man; space, the air, the river, the leaf. Art is applied to the mixture of his will with the same things, as in a house, a canal, a statue, a picture. But his operations taken together are so insignificant, a little chipping, baking, patching, and washing, that in an impression so grand as that of the world on the human mind, they do not vary the result.', 'default' ) ) . '
+' . esc_html__( "Undoubtedly we have no questions to ask which are unanswerable. We must trust the perfection of the creation so far, as to believe that whatever curiosity the order of things has awakened in our minds, the order of things can satisfy. Every man's condition is a solution in hieroglyphic to those inquiries he would put.", 'default' ) . '
+' . esc_html__( 'Get a virtual tour of the museum. Ideal for schools and events.', 'default' ) . '
+' . esc_html__( 'Stay updated and see our current exhibitions here.', 'default' ) . '
+' . esc_html__( 'Get to know our opening times, ticket prices and discounts.', 'default' ) . '
+