-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add "Recommended Plugins" input box #402
Conversation
Thanks for testing, @pbking!
It looks like the editor version was only updating the style.css file, so I've updated this PR so that the readme.txt file is also updated from the editor.
This is intentional (similar to how the image credits input works), as I was thinking that people wouldn't want to add recommended plugins to a blank theme. I've also removed the 'Recommended Plugins' input from the 'Create' sidebar panel, as I'm now thinking it's only useful on the 'Update' panel for now. We could revisit this when we align the wp-admin version and editor versions closer together. |
|
||
$default_copyright_section = "== Copyright == |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've refactored this and moved it lower down so that it's contained in copyright_section()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a placeholder with an example? It's been hard to find an explanation of this section; for instance, it's not listed in the docs https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/
I wondered if I should input a URL or if just the plugin's name would suffice, for example. I can also picture folks wondering if they should separate plugins with a comma or if the textarea will be printed into the document as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested and verified this is working as expected in the wp-admin and site editor flows.
While some of the changes are just formatting, I do think this is a lot of code to add for what is effectively just reading/writing some unstructured text to the readme, without enforcement or validation of those plugins coming from wp.org, for example. Unless I am missing something? It's a fair suggestion, but what's the real utility? For example, Gutenberg has a mechanism to prompt users to install respective plugins for blocks that are missing from templates / patterns a theme supplies.
I don't mean to block the PR, just adding my general thoughts.
src/editor-sidebar/update-panel.js
Outdated
return response.data; | ||
} | ||
return { | ||
recommendedPlugins: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to return an object with only this key as an empty string? Seems like a strange exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this so it's now returning an empty object with no specific keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I can see how having this info is useful for theme authors to inform users what plugins to install, and a lot of the changes are just refactoring / formatting, so giving it the ✅ .
Thanks, both, for testing this out!
I was also looking for an example, and the best reference I can find is here: https://make.wordpress.org/themes/handbook/review/required/#6-plugins. I think a placeholder is a good idea, I've added one here: 1b293ab, which looks like this:
Yes... sorry about that, this snowballed as I saw loads of improvements to the existing readme logic! Thank you for working through it. @pbking and I paired on this earlier today, and with our latest changes, the 'Recommended Plugins' textarea in the editor will now pre-populate with data from the current readme file, if this section already exists. This functionality also makes it easier to expand in the future for other parts of the readme file (e.g. image credits). I think this enhances the UX, as the user sees some feedback from updating the theme data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the placeholder! I gave it another go and it LGTM.
…sure other sections are not modified
I made a teeny tiny tweak to the regex processing to ensure that if another section is in readme.txt following the recommended plugins section that the title Otherwise this cleaned up great! Well done @mikachan ! This was a blast to pear on! |
This PR adds a "Recommended Plugins" input to the wp-admin page and editor versions of the plugin.
Closes #399.
Testing Instructions:
Screenshots:
wp-admin:
Editor sidebar panel: