-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Full Site Editing: Site Title Block [8] #33106
Comments
Be sure to take a look at and reuse @mattwiebe's MVP block work where possible (although it was a combined header block). |
cc @mattwiebe @obenland @mtias if you'd like to add any notes on requirements |
The header block lived most of its dev life as separate title and description blocks and extracting them as such from the MVP should be pretty easy. Note that Gutenberg does not provide any facility for option-backed blocks. The workarounds I did were, um, creative. Since the value is not serialized into the block itself, as Gutenberg expects, we have to use fake object attributes (that unfortunately get serialized) which we continually update in order to trick Gutenberg into believing the block has been updated. I also had to listen to various internal events in order to orchestrate saving.) This would seem to be a good time to try to shepherd WordPress/gutenberg#3112 to completion. Core will need it sooner or later and sooner is much better for us. |
Is this one in progress @codebykat? I was looking at the team board and moved it, but then wasn't sure. |
@codebykat is writing up some details on the site options work needed. Currently Gutenberg is not aware of this state, and it needs to be added in some form. |
Okay, for the first launch would @mattwiebe's original "creative" solution work? To quote Dennis -- "make it work, make it right, make it fast". ;) |
@apeatling I don't think the creative solution is worth it if the technical costs here are maybe another local editor store/API endpoint. The work here I think should be straightforward but we can maybe move with a "creative" fix + Gutenberg PR if we need explicit Gutenberg updates and can't wait for a proper release. |
Handing this one off for sabbatical! Internal discussion is at paYKcK-4a-p2 with next steps, but for now we're not going to worry about the The first thing to try here is to get @mattwiebe's implementation of the site title block from the MVP working as a standalone block (within post content / the current Gutenberg editor is fine). The relevant code is: |
I would recommend creating a dynamic block here, that doesn't generalize blocks backed by site options. It makes it a bit easier to build and we can replace this later with the core implementation. In other words, make a named site title block that is a dynamic block. Within post content, we don't serialize extra properties. It might look similar to something like this in code view The related PHP handler is then responsible for fetching the site title option and rendering that in page. Most of the work we need to do is within the edit function. Where we allow editing/interaction, save that in-memory (not serialized to post_content), and then make the related API request on publish. Happy to answer any related questions. See also: |
Let's create a site title new block in the full site editing plugin that is backed by the “blogname” record in the wp_options table. This means that we can update this value by:
Changes made in any of these areas should be correctly reflected.
Please verify if we need to respect any related title hooks on display.
We should not display anything on the published view, if "Display Site Title" is unchecked in the Customizer. Optional if we want to show this as a block option.
The site title can be be fetched/updated via core's
/settings
endpoint as thetitle
member.See also: paAmJe-nP-p2
The text was updated successfully, but these errors were encountered: