Full Site Editing: Add Support for Templates Default and Custom Titles and Descriptions#26394
Full Site Editing: Add Support for Templates Default and Custom Titles and Descriptions#26394
Conversation
lib/load.php
Outdated
|
|
||
| // Include FSE related files only if the experiment is enabled. | ||
| if ( gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing' ) ) { | ||
| require dirname( __FILE__ ) . '/full-site-editing/templates-definitions.php'; |
There was a problem hiding this comment.
We are starting to have a lot of FSE-related library files, so I think it's the case to group them in a separate folder.
I haven't moved the others to avoid bloating this PR.
|
Size Change: +958 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
7902652 to
69b1ccc
Compare
ff8b5c4 to
e751630
Compare
e751630 to
a9256b8
Compare
|
When I've replaced EDIT: sorted out thanks to @david-szabo97! ✨ |
5ac7875 to
15e1b3e
Compare
|
Similarly to When a template file provided by a theme is converted into a (Note: at the moment we only convert templates provided by the current theme, hence we simply get the current theme's stylesheet.) This "source" meta is displayed in the I haven't added this new info to the Site Editor sidebar or documents settings, as I think at this point it's becoming very crowded, and I'd rather wait for design feedback. Still, I believe the "source" is an essential information, and we should record it, and (at least temporarily while in development) display it in the |
Addison-Stavlo
left a comment
There was a problem hiding this comment.
Similarly to wp_template_part, I've added a new theme post meta to wp_template.
Great!
all other templates (edited by user) will simply show "Site".
This means that if a theme-provided template is edited by a user, and its status turns into publish, it's source will be "Site" and not "Theme" anymore".
I think we should try to make templates and template-parts consistent with how they behave regarding this sort of thing.
Currently, when a template-part is created by a user its theme is labeled as custom. I think either we should update template parts to be 'site' as well, or change it here to be 'custom' as well.
The other difference is that this only happens for new template parts. Template parts that originally come from a theme file will still have its theme's name saved in the meta once it goes from auto-draft to publish. I think this is by design as it corresponds to a template part from a specific theme that you have made customizations to, but the information about the theme it came from still exists as that information may still be useful.
If we are going with a status such astheme-provided, then we know that publish state is customized even if its theme meta still references the theme in which it came from. And maybe 'site' or 'custom' should only be given to templates that are created from scratch, and not those that are customized from a theme supplied one? 🤔
Yes!
But in a follow up, if we think this is the right way to go.
Sounds good 👍
Also, we need to be 100% sure about the new status name
theme-provided was my first idea, but it's not great (e.g. plugin can provide templates as well).
Ideally the name should convey that it originates from a file (file-based?),
Ah yeah, I'm not great with coming up with names either. Maybe something as simple as unedited would imply it came from an outside source and hasn't been changed?
I've definitely failed to explain how the meta is used. 🤦 When a user edits a Then, the Source column in the Lines 207 to 217 in 4b9eb4b I guess this might be improved a little bit. 🙂
That's not a very consistent behaviour... IMHO the empty string should be the way to go here, rather than using Templates are already like this: fully custom templates will be |
Addison-Stavlo
left a comment
There was a problem hiding this comment.
That makes sense, thanks for clarifying!
I guess this might be improved a little bit. 🙂
- If theme-provided: source is "Theme: Foobar".
- If fully custom: source is "Custom".
- If customized from a theme-provided template: source is "Custom - Originally from theme: Foobar"
Yeah that amount of distinction makes sense to me 👍 . (Maybe "Theme: Foobar (customized)" to keep it shorter if need be.)
IMHO the empty string should be the way to go here, rather than using custom (or any other arbitrary string).
I think you have convinced me that the empty string would also make more sense in the template-part case! This will be more consistent and we can always label them as 'Custom' in the interface if the theme meta is blank.
|
Replaced by #26636 |
Description
Fixes #25755
Update the templates handling to allow for custom titles and descriptions.
theme-provided(the name is bad, I'm open to suggestions!) custom status forwp_templateCPT to indicate those templates that have been imported from files and not touched by the user. Previously we were usingauto-draft, which wasn't super appropriate, and created a few complications (e.g. autodrafts can't have titles, aren't supposed to show up anywhere, etc.).excerptsto thewp_templateCPT. Right now titles and excerpts are only editable when editing the template in its own post editor.themepost meta, containing the source theme fortheme-providedtemplates.theme-providedand (at least temporarily)auto-drafttemplates.template_types_definitionsfilter, which is already used to temporarily remove theembeddefinition, since it's currently not supported.settings.defaultTemplateTypesDefinitionsofcore/edit-site.draft. They will becomepublished once saved the first time.Follow up
draftandpublish.How has this been tested?
Note: this will create new templates which are only accessible with the changes included in this PR. Changing branch would make the new templates inaccessible; they shouldn't be used by the site, but are still there, and may cause unexpected conflicts with pre-existing
auto-drafttemplates.wp_templateitems of statustheme-provided; this means that there will be duplicates./edit.php?post_type=wp_template).auto-drafttemplates. Feel free to wipe this list clean by moving all templates to trash. Newtheme-providedtemplates will be generated again once opening the Site Editor.+in the Templates menu).Screenshots
The new Templates wp-admin list:
The Site Editor sidebar using the new default definitions, and including a draft template:
The Site Editor documents settings using the new default definitions:
Types of changes
Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist: