File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-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+ * @return string
15+ */
16+ public function getBlockName (): string ;
17+
18+ /**
19+ * Returns block attributes.
20+ * @return array<string, mixed>
21+ */
22+ public function getAttributes (): array ;
23+
24+ /**
25+ * Returns inner blocks (for example, used in the Columns block).
26+ * @return BlockInterface[]
27+ */
28+ public function getInnerBlocks (): array ;
29+
30+ /**
31+ * Returns resultant HTML.
32+ * @return string
33+ */
34+ public function getInnerHtml (): string ;
35+
36+ /**
37+ * Returns list of string fragments and null markers where inner blocks were found.
38+ * @return array<?string>
39+ */
40+ public function getInnerContent (): array ;
41+ }
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