-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core/media-text adding custom block to allowed blocks #13955
Comments
Also interested in this. |
Is there any solution for this issue yet? Maybe a higher-order component to extend the Attention, pseudo code ahead
|
I have tried to alter the list of allowed (Inner) Blocks for two days now and haven’t been successful so far. There might be a simple alternative solution for your case though: If your custom block is only to be used as a child block of the core/media-text block you can explicitly set this core block as a parent in your custom block’s registerBlockType method like this: |
So, this is not possible at the moment. That said, the group block might be getting support for background images (like the cover block) and the group block can support any inner block which would address this issue. #14744 I'm going to keep this open at least until we get that. We should probably circle back to the issue a bit later. |
Allowed inner blocks should be defined at the block level. This should make them filterable and easier to find. A new field should be added to block definition - https://github.com/WordPress/gutenberg/blob/master/docs/rfc/block-registration.md |
Related: #16560 |
The Media and text block has no restrictions now so this can probably be closed. |
media blocks are still restricted to a limited selection of core blocks, so i'm not sure why this is closed. |
I'm also looking for a method to limit and/or extend the allowed blocks of Was this closed with a solution? I'm not seeing one. |
i have searched everywhere and i cannot find out how to achieve the following.
i want to add my custom block to the list of allowed blocks within the core/media-text block. i'm looking to extend the existing. In the handbook, i have tried the following (https://wordpress.org/gutenberg/handbook/designers-developers/developers/filters/block-filters/ > Using a whitelist ):
...editing getBlockTypes() to getBlockTypes('core/media-text'). however, i believe because the core block already has a whitelist applied this is whitelisting what has already been whitelisted, (not opening up all of the gutenberg blocks and then whitelisting those).
is there a way to extend this core block to include my custom block within their constant of allowed blocktypes:
const ALLOWED_BLOCKS = [ 'core/button', 'core/paragraph', 'core/heading', 'core/list' ];
?added note: i'm interested in achieving this without unregistering the block and re-registering one to replace it (if possible).
The text was updated successfully, but these errors were encountered: