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

Themes: Support title in templateParts #35626

Merged
merged 5 commits into from Oct 14, 2021
Merged

Conversation

Mamaduka
Copy link
Member

Description

Adds "title" support in templateParts theme.json configuration.

Fixes #34723.

Cc @gziolo, I saw that you introduced i18n for the customTemplates title, and I just wanted to check if I'm handling it correctly here.

How has this been tested?

  1. Update templateParts definition in theme, e.g. Blockbase.
  2. Go to the Site Editor -> Template Parts.
  3. Check that provided "title" is displayed.

Example

"templateParts": [
      {
	      "name": "header",
	      "title": "Header",
	      "area": "header"
      },
      {
	      "name": "footer",
	      "title": "Footer",
	      "area": "footer"
      }
]

Screenshots

Before After
CleanShot 2021-10-14 at 13 09 52 CleanShot 2021-10-14 at 13 10 20

Types of changes

Enhancement

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@Mamaduka Mamaduka self-assigned this Oct 14, 2021
@Mamaduka Mamaduka added [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement. labels Oct 14, 2021
@gziolo
Copy link
Member

gziolo commented Oct 14, 2021

I saw that you introduced i18n for the customTemplates title, and I just wanted to check if I'm handling it correctly here.

It should work on the Gutenberg/WordPress core side, but we also will have to open a patch against WP-CLI to update the i18n schema used there.

Edit: it looks like it should be automated now:

https://github.com/wp-cli/i18n-command/blob/ea8a6b3ab19c490798b420beabf06ece40b8e708/src/ThemeJsonExtractor.php#L19

@Mamaduka
Copy link
Member Author

it looks like it should be automated now:

Great news. Thanks, @gziolo.

@gziolo
Copy link
Member

gziolo commented Oct 14, 2021

There is another unit test that covers translations in theme.json that could get updated, too:
https://github.com/WordPress/gutenberg/blob/trunk/phpunit/class-wp-theme-json-resolver-test.php#L191-L199

@Mamaduka
Copy link
Member Author

@gziolo, how do you update language files for the test theme?

@Mamaduka
Copy link
Member Author

@gziolo figured it out.

P.S. Sorry about my Polish; I had to use a google translator.

@gziolo
Copy link
Member

gziolo commented Oct 14, 2021

@gziolo figured it out.

P.S. Sorry about my Polish; I had to use a google translator.

Good job updating the test 👍

I guess the translation is correct 😃

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

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

It looks good and it has enough test coverage 🚀

@Mamaduka Mamaduka merged commit c5c47e6 into trunk Oct 14, 2021
@Mamaduka Mamaduka deleted the add/themes-template-parts-title branch October 14, 2021 11:34
@github-actions github-actions bot added this to the Gutenberg 11.8 milestone Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

theme.json: support a description value for templateParts
2 participants