You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there @theaminuli Thank you so much for your topic idea. Please elaborate on your idea for this tutorial. Maybe you can post an outline and what the goal is of such an article. It might also help if you had a certain use case in mind that could be made into code examples.
@bph Thanks for the feedback! Here's an outline for a comprehensive tutorial on custom block supports:
Tutorial Outline: Creating Custom Block Supports in Gutenberg Goal:
Teach developers how to create reusable, support-like functionality for blocks using WordPress's existing infrastructure, following core patterns.
Use Case Example:
A "Reveal Animation" support that adds entrance animations to blocks:
The two-filter pattern: render_block + pre_render_block
Block support detection with block_has_support()
2. Building a Custom Support Handler
Following the core pattern from your position.php file
Attribute handling and validation
CSS class generation and HTML manipulation
3. Editor Integration
Adding inspector controls for the custom support
Using hasBlockSupport() in JavaScript
Conditional rendering based on support
4. Advanced Features
Dynamic CSS generation (like the Theme JSON approach in position.php)
Support inheritance and scoping
Performance considerations
5. Real-World Implementation Complete code for the "Reveal Animation" support with:
PHP backend processing
JavaScript editor controls
CSS generation
Block registration examples
This would give developers a practical framework for extending Gutenberg's capabilities while following WordPress best practices. The position.php file is a perfect reference since it shows the exact pattern used by core!
Would this approach work for the tutorial content you're looking for?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
WordPress/gutenberg#71012
Beta Was this translation helpful? Give feedback.
All reactions