Skip to content

Add Block Factory #6

Description

@XedinUnknown

The Problem

There is a Gutenberg\BlockInterface, and a common way of creating one seems to be by using a map returned by parse_blocks(). Unfortunately, there's nothing right now that could allow the creation of a block from such a map. There's no way at all to abstract block initialization.

Suggested Solution

  • Add a BlockFactoryInterface that would accept the key parameters for blocks separately and with proper type declarations.
  • Add a ConfigBasedBlockFactoryInterface that would accept an array map of values from one of the items of parse_blocks(). This allows easy creation from configuration, based on WP config key conventions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions