From ad0f88b345ddc3f8dc1eebcd529663a9375e209a Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Fri, 30 May 2025 15:40:02 +0100 Subject: [PATCH 1/3] Adds missing icons to main blocks. --- blocks/header/class-header-block.php | 12 +++++++++--- .../class-search-and-filter-block.php | 12 ++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/blocks/header/class-header-block.php b/blocks/header/class-header-block.php index ea971c8..533a5ea 100644 --- a/blocks/header/class-header-block.php +++ b/blocks/header/class-header-block.php @@ -65,13 +65,17 @@ protected function child_blocks(): array { 'logo', 'Logo', array(), - plugin_dir_path( __FILE__ ) . 'templates/logo.php' + plugin_dir_path( __FILE__ ) . 'templates/logo.php', + array(), + 'format-image' ), new Child_Block( 'general', 'General', array(), - plugin_dir_path( __FILE__ ) . 'templates/general.php' + plugin_dir_path( __FILE__ ) . 'templates/general.php', + array(), + 'admin-generic' ), new Child_Block( 'menu', @@ -85,7 +89,9 @@ protected function child_blocks(): array { 'choices' => $this->get_menu_choices(), ), ), - plugin_dir_path( __FILE__ ) . 'templates/menu.php' + plugin_dir_path( __FILE__ ) . 'templates/menu.php', + array(), + 'menu', ), ); } diff --git a/blocks/search-and-filter/class-search-and-filter-block.php b/blocks/search-and-filter/class-search-and-filter-block.php index 006a408..57fff00 100644 --- a/blocks/search-and-filter/class-search-and-filter-block.php +++ b/blocks/search-and-filter/class-search-and-filter-block.php @@ -208,36 +208,48 @@ protected function child_blocks(): array { 'Search and Filter Search', array(), plugin_dir_path( __FILE__ ) . 'templates/child-blocks/form/search.php', + array(), + 'search' ), new Child_Block( 'choice', 'Search and Filter Choice', array(), plugin_dir_path( __FILE__ ) . 'templates/child-blocks/form/choice.php', + array(), + 'yes-alt' ), new Child_Block( 'range', 'Search and Filter Range', array(), plugin_dir_path( __FILE__ ) . 'templates/child-blocks/form/range.php', + array(), + 'filter' ), new Child_Block( 'advanced', 'Search and Filter Advanced', array(), plugin_dir_path( __FILE__ ) . 'templates/child-blocks/form/advanced.php', + array(), + 'filter', ), new Child_Block( 'reusable', 'Search and Filter Reusable', array(), plugin_dir_path( __FILE__ ) . 'templates/child-blocks/form/reusable.php', + array(), + 'filter', ), new Child_Block( 'control', 'Search and Filter Control', array(), plugin_dir_path( __FILE__ ) . 'templates/child-blocks/form/control.php', + array(), + 'filter', ), ) ), From f2fe0e9f8da7f2c9c53126467964e5a814a16962 Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Mon, 2 Jun 2025 08:49:08 +0100 Subject: [PATCH 2/3] Fixes doc deployment branch. --- .github/workflows/build-docs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docs.yaml b/.github/workflows/build-docs.yaml index 6e2264e..ad62cd1 100644 --- a/.github/workflows/build-docs.yaml +++ b/.github/workflows/build-docs.yaml @@ -33,14 +33,14 @@ jobs: - name: Upload GitHub Pages artifact uses: actions/upload-pages-artifact@v3.0.1 - if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}" + if: "${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') && endsWith(github.ref, '.x') }}" with: path: "build/docs" retention-days: 1 deploy: name: "Deploy" - if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}" + if: "${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') && endsWith(github.ref, '.x') }}" runs-on: "ubuntu-latest" # Grant GITHUB_TOKEN the permissions required to make a Pages deployment From 58f9748b1963f2250abe4f35c6458e6a42aa681a Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Mon, 2 Jun 2025 08:49:36 +0100 Subject: [PATCH 3/3] Adds basic documentation for upgrading. --- docs/.vitepress/config.mjs | 3 ++- docs/upgrading.md | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 docs/upgrading.md diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index 46e747e..4712c8d 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -18,7 +18,8 @@ export default defineConfig({ collapsed: false, items: [ { text: 'What Is It?', link: '/what-is-it' }, - { text: 'Quick Start', link: '/quick-start' } + { text: 'Quick Start', link: '/quick-start' }, + { text: 'Upgrading', link: '/upgrading' }, ] }, { diff --git a/docs/upgrading.md b/docs/upgrading.md new file mode 100644 index 0000000..7d13a50 --- /dev/null +++ b/docs/upgrading.md @@ -0,0 +1,25 @@ +--- +title: Upgrading +editLink: false +--- + +# Upgrading +This guide covers breaking changes between versions of the block plugin. If you are upgrading from a version prior to 1.x, you will need to follow the instructions below. + +## Upgrading from 0.x to 1.x + +### Changes to the block class +As part of the upgrade to 1.x of the block plugin, the base block class now includes the `Trait_Has_Modifier_Classes` trait. This trait is used to add modifier classes to the block. + +This change breaks existing blocks due to the requirement of a new `default-wrapper.php` template for blocks. In order to upgrade, you will need to add the following function declaration to any existing block classes created prior to 1.x: + +```php +/** + * {@inheritdoc} + */ +protected function use_default_wrapper_template(): bool { + return false; +} +``` + +This ensures that the block will not use the default wrapper template. \ No newline at end of file