Skip to content

feat: add support for generating block names #12135

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akhrarovsaid
Copy link
Contributor

What?

This PR introduces a new admin.generateBlockName function to block configs which allows for generating blockName's using data available via the doc and block data itself. This would allow users to generate these names via functions in config instead of defining custom Label components for blocks.

This PR also adds tests to ensure these block names are generated and to prevent overriding editor-authored block names, as well as docs changes.

Why?

To enable users to generate block names with functions defined in config.

How?

Adding a new admin.generateBlockName function, and threading it through to addFieldStatePromise.ts.

Fixes #12112 & addresses #4648

Demo:

Payload-generated-blockName-demo.webm

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

Successfully merging this pull request may close these issues.

Blocks Field - Components docs inaccurate
1 participant