plugin / yard-gutenberg
A collection of blocks for the WordPress Gutenberg editor.
Installs: 183
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 3
Language:JavaScript
Type:wordpress-plugin
pkg:composer/plugin/yard-gutenberg
Requires
- php: >=7.4
- wp-cli/wp-cli-bundle: ^2.6
Requires (Dev)
- 10up/wp_mock: ^0.5.0
- friendsofphp/php-cs-fixer: ^3.14
- phpunit/phpunit: ^9.6
- dev-main
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.15
- v0.1.14
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-fix/tabs-and-link-icon
This package is auto-updated.
Last update: 2025-12-05 10:32:54 UTC
README
A WordPress plugin with a collection of components for the Gutenberg editor
👷♀️ Development
- Run
nvm useto automatically use the correct version of Node.js - Run
npm installto install dependencies - Run
npm startfor local development
🚀 Release
TODO: automate this
- Update plugin versions and run
npm run buildto build assets. Commit and push to remote. - Add tag
git tag v0.1.0and push to remotegit push origin v0.1.0
PHP Hooks
yard::gutenberg/allowed-blocks
By default, all blocks are registered. Use this filter to register only the allowed blocks. The example below lists every available block:
add_filter('yard::gutenberg/allowed-blocks', fn () => [ 'collapse', 'collapse-item', 'counting-number', 'facetwp', 'icon', 'iconlist', 'iconlist-item', 'slide', 'slider', 'tabs', 'tabs-item', ]);
yard::gutenberg/allowed-core-blocks
Overwrite the allowed (core) blocks.
add_filter('yard::gutenberg/allowed-core-blocks', $this->registerCoreBlocks(...), 10, 1); public function registerCoreBlocks($initialAllowedBlocks): array { $additionalBlocks = collect([ // 'core/search', ]); $excludeBlocks = collect([ // 'core/post-featured-image', ]); return collect($initialAllowedBlocks) ->merge($additionalBlocks) ->reject(fn ($block) => $excludeBlocks->contains($block)) ->all(); }
yard::gutenberg/allowed-blocks-whitelisted-prefixes
By default, all blocks are registered. Use this filter to register only the allowed blocks with a specific prefix. The example adds the tribe prefix:
add_filter('yard::gutenberg/allowed-blocks-whitelisted-prefixes', fn ($prefixes) => [ ...$prefixes, 'tribe', ] );
JavaScript Hooks
yard.default-unused-styles
Change the default unregistered styles: /src/Hooks/resources/js/default-block-styles.js:
import { addFilter } from '@wordpress/hooks'; addFilter( 'yard.default-unused-styles', 'sage/default-unused-styles', (styles) => { return styles.map((item) => { // Remove 'fill' style from the array, so that it works again if (item.block === 'core/button') { return { ...item, styles: item.styles.filter(style => style !== 'fill') }; } return item; }); } );
yard.default-registered-variations
Remove specific variations: /src/Hooks/resources/js/default-block-variations.js:
import { addFilter } from '@wordpress/hooks'; // Remove specific variations from the registered list addFilter( 'yard.default-registered-variations', 'your-project/remove-registered-variations', (variations) => { return variations.filter((item) => { // Remove the custom spacer variation if (item.block === 'core/spacer' && item.name === 'spacer-with-steps') { return false; // Exclude this variation } // Keep all other variations return true; }); } );
Or change an existing variation:
addFilter( 'yard.default-registered-variations', 'your-project/modify-registered-variations', (variations) => { return variations.map((item) => { // Change the height attribute for the spacer variation if (item.block === 'core/spacer' && item.name === 'spacer-with-steps') { return { ...item, attributes: { ...item.attributes, height: 'var:preset|spacing|9', // New height value }, }; } return item; }); } );
yard.default-unused-variations
Remove a default unregistered variations so that it works again: /src/Hooks/resources/js/default-block-variations.js:
import { addFilter } from '@wordpress/hooks'; addFilter( 'yard.default-unused-variations', 'your-project/remove-unused-variations', (variations) => { return variations.filter((item) => { if (item.block === 'core/group' && item.variation === 'group-row') { return false; // Remove this variation so that it works again } // Keep all other variations in the unused list return true; }); } );