Opened 6 years ago
Closed 6 years ago
#3789 closed task (blessed) (duplicate)
Implement plugin with Gutenberg block types for Update PHP page
Reported by: | flixos90 | Owned by: | nerrad |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | HelpHub (wordpress.org/documentation) | Keywords: | needs-patch dev-feedback needs-design needs-unit-tests has-screenshots neso |
Cc: |
Description
The Update PHP information page (which is currently live at https://wordpress.org/support/upgrade-php/) requires a bit of dynamic content that should be implemented as custom Gutenberg block types.
We need a plugin that contains those block types, plus additional functionality the page might need. Let's use the slug update-php
for the plugin. The following steps are needed for the first iteration:
- Scaffold the plugin, including typical Webpack and Babel workflows for plugins extending Gutenberg. Support for Sass should be built-in as well.
- Implement a block type
update-php/version-notice
that uses server-side rendering (similar likecore/latest-posts
for example). The block type should check a URL query parameterphp_version
, and if provided act on it. The content that should conditionally be displayed would depend on whether the version is supported or out of date. However, all text for the different conditions should be specified via block type controls. See the beginning of the https://docs.google.com/document/d/1_L76gu0Uj-7qNKazpuKyIn1TwnNk8kE20-anMVOgyHg/edit for what content should be hosted and for an idea of what the basic markup should look like. The actual texts would only be provided via the block controls (as they are connected to the page content) and should not have any defaults, as that would require redundant translations later when the page is localized. - Request design help to provide styling to the block which fits with wordpress.org/support/ appearance. The Sass needed can accompany the block type.
- Implement a simple piece of logic to redirect from
{$homeurl}/upgrade-php/
to{$homeurl}/update-php/
. Right before the plugin is activated later, the existing page's slug should be modified from "upgrade-php" to "update-php".
Since this process consists of multiple steps, it's fine iterating over them. A first patch would be great to only provide the block type logic and not bother adding design. However, the markup generated should preferably support content somewhat similar to the Google doc linked above.
Further block types for the Update PHP page will likely be required, but those haven't been determined yet and could also be implemented in follow-up tickets. Let's set the first milestone to the things that we already know we need (mentioned above) and commit once they are ready.
Change History (9)
This ticket was mentioned in Slack in #core-php by flixos90. View the logs.
6 years ago
This ticket was mentioned in Slack in #core-php by nerrad. View the logs.
6 years ago
This ticket was mentioned in Slack in #core-php by schlessera. View the logs.
6 years ago
#6
@
6 years ago
I'm personally not convinced that a Gutenberg plugin is actually needed for this, as it seems like a perfect use-case for a page template and theme-specific CSS. Just because it can be used, doesn't mean it should be.
Is there any background available anywhere as to why this page has been done as a WordPress page, and not as a SVN revisioned document like every other page on WordPress.org? (Which makes it significantly easier to provide translated variants of them)
This ticket was mentioned in Slack in #core-php by nerrad. View the logs.
6 years ago
This ticket was mentioned in Slack in #core-php by sergey. View the logs.
6 years ago
#9
@
6 years ago
- Resolution set to duplicate
- Status changed from assigned to closed
Per the latest #core-php chat, closing in favor of #4004.
Okay the initial build of the plugin is done.
The repository is for the plugin here: https://github.com/nerrad/update-php
A release build (for installation from zip) is here: https://github.com/nerrad/update-php/archive/0.1.0.zip
Regarding redirect logic requested:
I don't think this should be done by the plugin but instead should be something done at the server level. Having plugins handle redirects of this nature is more resource intensive (because WordPress has to be loaded twice) than simply adding the redirect to the webserver config. So maybe request this from the wp.org systems team?
Flow
Here's some gifs showing the block in action (editor and frontend) Note: The links below work when clicking on them (trac isn't embedding it as content though).
Creating the block and toggling what is previewed in the editor:
Modifying content:
Frontend:
Summary
detected-php-content
. The title is in a<h4>
tag, the body is just a paragraph block, and the emphasis section is a paragraph block with the css classdetected-php-emphasis
so styling should be fairly straightforward. I can help with that or anyone can submit a pull request.The block:
widgets
category for blocks and just has a simple "list" icon. This can change.<ServerSideRender>
because the block is simple so quicker to do js preview. Also, no need for unnecessary round-trips to the server).The frontend:
php_version
in the request (that can easily be changed if something else is used) and displays the appropriate messaging from the block attributes. If there is nophp_version
in the request then none of the block content is shown.What Next?