Commit Graph

3 Commits

Author SHA1 Message Date
Gary Pendergast
f7d01b4e70 Blocks: Introduce the block parser.
The `WP_Block_Parser` class, and the accompanying `parse_blocks()` helper function, can be used to parse an array of blocks out of a content string.

`WP_Block_Parser` is copied from the `@wordpress/block-serialization-default-parser` package. To ensure it stays in sync with the JavaScript parser, changes should be implemented in the package first, then the package version should be upgraded to include the changes.

See #45109.


Built from https://develop.svn.wordpress.org/branches/5.0@43751


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-10-18 04:40:27 +00:00
Gary Pendergast
28310289bd Blocks: Introduce register_block_type(), unregister_block_type(), and get_dynamic_blocks() functions.
These helper functions allow easy access to the global block registry.

See #45109.


Built from https://develop.svn.wordpress.org/branches/5.0@43743


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-10-18 01:53:26 +00:00
Gary Pendergast
22840639e8 Blocks: Introduce WP_Block_Type and WP_Block_Type_Registry classes.
These are the foundational classes allowing blocks to be registered and used throughout WordPress.

This commit also includes the `has_block()` and `has_blocks()` functions, which are required for unit testing these classes.

Props adamsilverstein, danielbachhuber, desrosj.
See #45097, #45109.


Built from https://develop.svn.wordpress.org/branches/5.0@43742


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-10-18 01:31:26 +00:00