File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
66
77## [[ * next-version* ]] - YYYY-MM-DD
8+ ### Added
9+ - Interfaces for Gutenberg blocks parsing.
810
911## [ 0.1.0-alpha1] - 2021-03-05
1012Initial version.
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace WpOop \WordPress \Gutenberg ;
6+
7+ /**
8+ * The interface for Gutenberg block data.
9+ */
10+ interface BlockInterface
11+ {
12+ /**
13+ * Returns name of the block, such as 'core/paragraph'.
14+ */
15+ public function getBlockName (): string ;
16+
17+ /**
18+ * Returns block attributes.
19+ * @return array<string, mixed>
20+ */
21+ public function getAttributes (): array ;
22+
23+ /**
24+ * Returns inner blocks (for example, used in the Columns block).
25+ * @return BlockInterface[]
26+ */
27+ public function getInnerBlocks (): array ;
28+
29+ /**
30+ * Returns resultant HTML.
31+ */
32+ public function getInnerHtml (): string ;
33+
34+ /**
35+ * Returns list of string fragments and null markers where inner blocks were found.
36+ * @return array<?string>
37+ */
38+ public function getInnerContent (): array ;
39+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace WpOop \WordPress \Gutenberg ;
6+
7+ /**
8+ * The interface for parsing Gutenberg blocks.
9+ */
10+ interface BlockParserInterface
11+ {
12+ /**
13+ * @param string $postContent Content of a WP post (e.g. WP_Post post_content).
14+ * @return BlockInterface[]
15+ */
16+ public function parseBlock (string $ postContent ): array ;
17+ }
You can’t perform that action at this time.
0 commit comments