Skip to content

Commit df16189

Browse files
committed
Block Editor: Move Block Patterns API functions to block-patterns.php.
Follow-up to [48156]. Props anukasha, dhiraj0901, swissspidy, palak678, madhavishah01. See #50445. Fixes #64234. git-svn-id: https://develop.svn.wordpress.org/trunk@61348 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8867703 commit df16189

File tree

3 files changed

+53
-53
lines changed

3 files changed

+53
-53
lines changed

src/wp-includes/block-patterns.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,59 @@
88

99
add_theme_support( 'core-block-patterns' );
1010

11+
/**
12+
* Registers a new block pattern.
13+
*
14+
* @since 5.5.0
15+
*
16+
* @param string $pattern_name Block pattern name including namespace.
17+
* @param array $pattern_properties List of properties for the block pattern.
18+
* See WP_Block_Patterns_Registry::register() for accepted arguments.
19+
* @return bool True if the pattern was registered with success and false otherwise.
20+
*/
21+
function register_block_pattern( $pattern_name, $pattern_properties ) {
22+
return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties );
23+
}
24+
25+
/**
26+
* Unregisters a block pattern.
27+
*
28+
* @since 5.5.0
29+
*
30+
* @param string $pattern_name Block pattern name including namespace.
31+
* @return bool True if the pattern was unregistered with success and false otherwise.
32+
*/
33+
function unregister_block_pattern( $pattern_name ) {
34+
return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name );
35+
}
36+
37+
/**
38+
* Registers a new pattern category.
39+
*
40+
* @since 5.5.0
41+
*
42+
* @param string $category_name Pattern category name including namespace.
43+
* @param array $category_properties List of properties for the block pattern.
44+
* See WP_Block_Pattern_Categories_Registry::register() for
45+
* accepted arguments.
46+
* @return bool True if the pattern category was registered with success and false otherwise.
47+
*/
48+
function register_block_pattern_category( $category_name, $category_properties ) {
49+
return WP_Block_Pattern_Categories_Registry::get_instance()->register( $category_name, $category_properties );
50+
}
51+
52+
/**
53+
* Unregisters a pattern category.
54+
*
55+
* @since 5.5.0
56+
*
57+
* @param string $category_name Pattern category name including namespace.
58+
* @return bool True if the pattern category was unregistered with success and false otherwise.
59+
*/
60+
function unregister_block_pattern_category( $category_name ) {
61+
return WP_Block_Pattern_Categories_Registry::get_instance()->unregister( $category_name );
62+
}
63+
1164
/**
1265
* Registers the core block patterns and categories.
1366
*

src/wp-includes/class-wp-block-pattern-categories-registry.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -162,30 +162,3 @@ public static function get_instance() {
162162
return self::$instance;
163163
}
164164
}
165-
166-
/**
167-
* Registers a new pattern category.
168-
*
169-
* @since 5.5.0
170-
*
171-
* @param string $category_name Pattern category name including namespace.
172-
* @param array $category_properties List of properties for the block pattern.
173-
* See WP_Block_Pattern_Categories_Registry::register() for
174-
* accepted arguments.
175-
* @return bool True if the pattern category was registered with success and false otherwise.
176-
*/
177-
function register_block_pattern_category( $category_name, $category_properties ) {
178-
return WP_Block_Pattern_Categories_Registry::get_instance()->register( $category_name, $category_properties );
179-
}
180-
181-
/**
182-
* Unregisters a pattern category.
183-
*
184-
* @since 5.5.0
185-
*
186-
* @param string $category_name Pattern category name including namespace.
187-
* @return bool True if the pattern category was unregistered with success and false otherwise.
188-
*/
189-
function unregister_block_pattern_category( $category_name ) {
190-
return WP_Block_Pattern_Categories_Registry::get_instance()->unregister( $category_name );
191-
}

src/wp-includes/class-wp-block-patterns-registry.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -277,29 +277,3 @@ public static function get_instance() {
277277
return self::$instance;
278278
}
279279
}
280-
281-
/**
282-
* Registers a new block pattern.
283-
*
284-
* @since 5.5.0
285-
*
286-
* @param string $pattern_name Block pattern name including namespace.
287-
* @param array $pattern_properties List of properties for the block pattern.
288-
* See WP_Block_Patterns_Registry::register() for accepted arguments.
289-
* @return bool True if the pattern was registered with success and false otherwise.
290-
*/
291-
function register_block_pattern( $pattern_name, $pattern_properties ) {
292-
return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties );
293-
}
294-
295-
/**
296-
* Unregisters a block pattern.
297-
*
298-
* @since 5.5.0
299-
*
300-
* @param string $pattern_name Block pattern name including namespace.
301-
* @return bool True if the pattern was unregistered with success and false otherwise.
302-
*/
303-
function unregister_block_pattern( $pattern_name ) {
304-
return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name );
305-
}

0 commit comments

Comments
 (0)