Skip to content
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

Options: Add 'label' argument to register_setting #6495

Closed

Conversation

Mamaduka
Copy link
Member

@Mamaduka Mamaduka commented May 3, 2024

A sync ticket for WordPress/gutenberg#59243.

Trac ticket: https://core.trac.wordpress.org/ticket/61023


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@Mamaduka Mamaduka self-assigned this May 3, 2024
@@ -237,6 +237,7 @@ protected function get_registered_options() {

$default_schema = array(
'type' => empty( $args['type'] ) ? null : $args['type'],
'label' => empty( $args['label'] ) ? '' : $args['label'],
Copy link
Member Author

@Mamaduka Mamaduka May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimothyBJacobs, in Gutenberg shim, we used the title key for the schema. Would it make sense to have a direct mapping to the argument here, or is the title key reserved for similar data in schemas?

Gutenberg PR: WordPress/gutenberg#59243

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it should be title as the prop name. That is how it's defined in the JSON Schema spec.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification!

Copy link

github-actions bot commented May 3, 2024

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link

github-actions bot commented May 3, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props mamaduka, timothyblynjacobs, ellatrix.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka force-pushed the add/register-setting-label-arg branch from 3eab7d7 to 04d1a06 Compare May 3, 2024 09:42
Copy link
Member

@TimothyBJacobs TimothyBJacobs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The wp-api-generated.js file will need to be rebuilt before committing.

@Mamaduka
Copy link
Member Author

Mamaduka commented May 3, 2024

Thanks for the review, @TimothyBJacobs 🙇

The wp-api-generated.js file will need to be rebuilt before committing.

I always forget about it. I wish there was a pre-commit hook for it. To update it, I need to run a full PHP test suite, correct?

Running the following command did the trick - npm run test:php -- --group restapi-jsclient. Though, I'm not sure why it reshuffled the fixture.

@TimothyBJacobs
Copy link
Member

Yeah the process is a bit frustrating. Was GB active on your checkout?

@Mamaduka
Copy link
Member Author

Mamaduka commented May 3, 2024

Was GB active on your checkout?

No. I've got a separate installation just for core patches.

Edit: I updated fixtures again by running the whole test suite, and it worked.

@ellatrix
Copy link
Member

@Mamaduka Is this good to merge?

@Mamaduka
Copy link
Member Author

@ellatrix, yes, it's good to be merged.

@ellatrix
Copy link
Member

Could you merge it?

@ellatrix
Copy link
Member

Should WordPress/gutenberg#61351 be included here or in a separate backport?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants