From eb122fc9f2b4370bf700af05b6377bfc8b3eee9f Mon Sep 17 00:00:00 2001 From: Alex P Date: Tue, 6 Apr 2021 18:41:05 +0300 Subject: [PATCH] Add interfaces for Gutenberg blocks parsing --- CHANGELOG.md | 2 ++ src/Gutenberg/BlockInterface.php | 39 ++++++++++++++++++++++++++ src/Gutenberg/BlockParserInterface.php | 17 +++++++++++ 3 files changed, 58 insertions(+) create mode 100644 src/Gutenberg/BlockInterface.php create mode 100644 src/Gutenberg/BlockParserInterface.php diff --git a/CHANGELOG.md b/CHANGELOG.md index c7c209b..048462d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [[*next-version*]] - YYYY-MM-DD +### Added +- Interfaces for Gutenberg blocks parsing. ## [0.1.0-alpha1] - 2021-03-05 Initial version. diff --git a/src/Gutenberg/BlockInterface.php b/src/Gutenberg/BlockInterface.php new file mode 100644 index 0000000..7793e6d --- /dev/null +++ b/src/Gutenberg/BlockInterface.php @@ -0,0 +1,39 @@ + + */ + public function getAttributes(): array; + + /** + * Returns inner blocks (for example, used in the Columns block). + * @return BlockInterface[] + */ + public function getInnerBlocks(): array; + + /** + * Returns resultant HTML. + */ + public function getInnerHtml(): string; + + /** + * Returns list of string fragments and null markers where inner blocks were found. + * @return array + */ + public function getInnerContent(): array; +} diff --git a/src/Gutenberg/BlockParserInterface.php b/src/Gutenberg/BlockParserInterface.php new file mode 100644 index 0000000..2863f28 --- /dev/null +++ b/src/Gutenberg/BlockParserInterface.php @@ -0,0 +1,17 @@ +