Skip to content

Proposal: PHP method to retrieve block supports separately for outer wrapper and innerblocks #76109

@eric-michel

Description

@eric-michel

What problem does this address?

We build one-off custom blocks for client sites that may not need to be modified for months or years. We typically build these blocks entirely in PHP because they are easier to update after long periods of time compared to React blocks that require a build process that depends on hundreds of NPM packages that can go out of date. We're currently using ACF to do this, but hope to eventually use PHP-only blocks that support InnerBlocks.

One issue we regularly run into is separating block settings between outer and inner wrappers. get_block_wrapper_attributes is great, but outputs all block support classes and styles into a single element. That means styles intended for outer wrappers, like alignment, but also styles for inner wrappers, like flex layout or block spacing.

It's pretty common that a single element acts as both the outer wrapper and the innerblocks container, but sometimes we need them separate (like the Cover block). To my knowledge, there is no easy way to get these settings separately outside of parsing every option and generating your own styles for every one.

What is your proposed solution?

Provide a way to retrieve the output-ready HTML attributes that represent block settings separately based on whether those settings are for inner or outer wrappers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block APIAPI that allows to express the block paradigm.[Type] EnhancementA suggestion for improvement.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions