Changeset 55173
- Timestamp:
- 02/01/2023 03:00:19 PM (20 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-patterns.php
r55168 r55173 299 299 * - Description 300 300 * - Viewport Width 301 * - Inserter (yes/no) 301 302 * - Categories (comma-separated values) 302 303 * - Keywords (comma-separated values) … … 304 305 * - Post Types (comma-separated values) 305 306 * - Template Types (comma-separated values) 306 * - Inserter (yes/no)307 307 * 308 308 * @since 6.0.0 309 * @since 6.1.0 The `postTypes` property was added. 310 * @since 6.2.0 The `templateTypes` property was added. 309 311 * @access private 310 312 */ … … 315 317 'description' => 'Description', 316 318 'viewportWidth' => 'Viewport Width', 319 'inserter' => 'Inserter', 317 320 'categories' => 'Categories', 318 321 'keywords' => 'Keywords', 319 322 'blockTypes' => 'Block Types', 320 323 'postTypes' => 'Post Types', 321 'inserter' => 'Inserter',322 324 'templateTypes' => 'Template Types', 323 325 ); -
trunk/src/wp-includes/class-wp-block-patterns-registry.php
r54850 r55173 44 44 * @since 5.5.0 45 45 * @since 5.8.0 Added support for the `blockTypes` property. 46 * @since 6.1.0 Added support for the `postTypes` property. 47 * @since 6.2.0 Added support for the `templateTypes` property. 46 48 * 47 49 * @param string $pattern_name Block pattern name including namespace. … … 51 53 * @type string $title Required. A human-readable title for the pattern. 52 54 * @type string $content Required. Block HTML markup for the pattern. 53 * @type string $description Optional. Visually hidden text used to describe the pattern in the54 * in serter. A description is optional, but is strongly55 * @type string $description Optional. Visually hidden text used to describe the pattern 56 * in the inserter. A description is optional, but is strongly 55 57 * encouraged when the title does not fully describe what the 56 58 * pattern does. The description will help users discover the … … 58 60 * @type int $viewportWidth Optional. The intended width of the pattern to allow for a scaled 59 61 * preview within the pattern inserter. 60 * @type array $categories Optional. A list of registered pattern categories used to group block 61 * patterns. Block patterns can be shown on multiple categories. 62 * A category must be registered separately in order to be used 63 * here. 62 * @type array $categories Optional. A list of registered pattern categories used to group 63 * block patterns. Block patterns can be shown on multiple categories. 64 * A category must be registered separately in order to be used here. 65 * @type array $keywords Optional. A list of aliases or keywords that help users discover 66 * the pattern while searching. 64 67 * @type array $blockTypes Optional. A list of block names including namespace that could use 65 68 * the block pattern in certain contexts (placeholder, transforms). … … 69 72 * (e.g. for `core/template-part` you can specify areas 70 73 * like `core/template-part/header` or `core/template-part/footer`). 71 * @type array $postTypes An array of post types that the pattern is restricted to be used with. 72 * The pattern will only be available when editing one of the post types 73 * passed on the array. For all the other post types not part of the array 74 * the pattern is not available at all. 75 * @type array $keywords Optional. A list of aliases or keywords that help users discover the 76 * pattern while searching. 74 * @type array $postTypes Optional. An array of post types that the pattern is restricted 75 * to be used with. The pattern will only be available when editing one 76 * of the post types passed on the array. For all the other post types 77 * not part of the array the pattern is not available at all. 78 * @type array $templateTypes Optional. An array of template types where the pattern fits. 77 79 * } 78 80 * @return bool True if the pattern was registered with success and false otherwise. -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php
r55168 r55173 166 166 'name' => 'name', 167 167 'title' => 'title', 168 'content' => 'content', 168 169 'description' => 'description', 169 170 'viewportWidth' => 'viewport_width', 171 'inserter' => 'inserter', 172 'categories' => 'categories', 173 'keywords' => 'keywords', 170 174 'blockTypes' => 'block_types', 171 175 'postTypes' => 'post_types', 172 'categories' => 'categories',173 'keywords' => 'keywords',174 'content' => 'content',175 'inserter' => 'inserter',176 176 'templateTypes' => 'template_types', 177 177 ); … … 214 214 'context' => array( 'view', 'edit', 'embed' ), 215 215 ), 216 'content' => array( 217 'description' => __( 'The pattern content.' ), 218 'type' => 'string', 219 'readonly' => true, 220 'context' => array( 'view', 'edit', 'embed' ), 221 ), 216 222 'description' => array( 217 223 'description' => __( 'The pattern detailed description.' ), … … 226 232 'context' => array( 'view', 'edit', 'embed' ), 227 233 ), 228 'block_types' => array(229 'description' => __( 'Block types that the pattern is intended to be used with.' ),230 'type' => 'array',231 'readonly' => true,232 'context' => array( 'view', 'edit', 'embed' ),233 ),234 'post_types' => array(235 'description' => __( 'An array of post types that the pattern is restricted to be used with.' ),236 'type' => 'array',237 'readonly' => true,238 'context' => array( 'view', 'edit', 'embed' ),239 ),240 'categories' => array(241 'description' => __( 'The pattern category slugs.' ),242 'type' => 'array',243 'readonly' => true,244 'context' => array( 'view', 'edit', 'embed' ),245 ),246 'keywords' => array(247 'description' => __( 'The pattern keywords.' ),248 'type' => 'array',249 'readonly' => true,250 'context' => array( 'view', 'edit', 'embed' ),251 ),252 'template_types' => array(253 'description' => __( 'An array of template types where the pattern fits.' ),254 'type' => 'array',255 'readonly' => true,256 'context' => array( 'view', 'edit', 'embed' ),257 ),258 'content' => array(259 'description' => __( 'The pattern content.' ),260 'type' => 'string',261 'readonly' => true,262 'context' => array( 'view', 'edit', 'embed' ),263 ),264 234 'inserter' => array( 265 235 'description' => __( 'Determines whether the pattern is visible in inserter.' ), … … 268 238 'context' => array( 'view', 'edit', 'embed' ), 269 239 ), 240 'categories' => array( 241 'description' => __( 'The pattern category slugs.' ), 242 'type' => 'array', 243 'readonly' => true, 244 'context' => array( 'view', 'edit', 'embed' ), 245 ), 246 'keywords' => array( 247 'description' => __( 'The pattern keywords.' ), 248 'type' => 'array', 249 'readonly' => true, 250 'context' => array( 'view', 'edit', 'embed' ), 251 ), 252 'block_types' => array( 253 'description' => __( 'Block types that the pattern is intended to be used with.' ), 254 'type' => 'array', 255 'readonly' => true, 256 'context' => array( 'view', 'edit', 'embed' ), 257 ), 258 'post_types' => array( 259 'description' => __( 'An array of post types that the pattern is restricted to be used with.' ), 260 'type' => 'array', 261 'readonly' => true, 262 'context' => array( 'view', 'edit', 'embed' ), 263 ), 264 'template_types' => array( 265 'description' => __( 'An array of template types where the pattern fits.' ), 266 'type' => 'array', 267 'readonly' => true, 268 'context' => array( 'view', 'edit', 'embed' ), 269 ), 270 270 ), 271 271 ); -
trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php
r55168 r55173 79 79 array( 80 80 'title' => 'Pattern One', 81 'content' => '<!-- wp:heading {"level":1} --><h1>One</h1><!-- /wp:heading -->', 82 'viewportWidth' => 1440, 81 83 'categories' => array( 'test' ), 82 'viewportWidth' => 1440,83 'content' => '<!-- wp:heading {"level":1} --><h1>One</h1><!-- /wp:heading -->',84 84 'templateTypes' => array( 'page' ), 85 85 ) … … 90 90 array( 91 91 'title' => 'Pattern Two', 92 'content' => '<!-- wp:paragraph --><p>Two</p><!-- /wp:paragraph -->', 92 93 'categories' => array( 'test' ), 93 'content' => '<!-- wp:paragraph --><p>Two</p><!-- /wp:paragraph -->',94 94 'templateTypes' => array( 'single' ), 95 95 ) … … 100 100 array( 101 101 'title' => 'Pattern Three', 102 'content' => '<!-- wp:paragraph --><p>Three</p><!-- /wp:paragraph -->', 102 103 'categories' => array( 'test', 'buttons', 'query' ), 103 'content' => '<!-- wp:paragraph --><p>Three</p><!-- /wp:paragraph -->',104 104 ) 105 105 );
Note: See TracChangeset
for help on using the changeset viewer.