-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 a filter('editor.FeaturedImage') for the FeaturedImage component #6940
Conversation
@adamsilverstein @gziolo Prior to merging, can one of you open a PR against https://github.com/danielbachhuber/gutenberg-migration-guide/blob/master/filter-admin-post-thumbnail-html.md with documentation on how this works? |
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.
Did you consider adding this filter directly on the editor component instead of on the panel wrapper?
My concern is that you rather don’t want to allow plugin developers to replace this panel with anything else. You rather would expect to replace panel’s content with something else, prepend or append HTML code or disable the panel completely.
I think that we should rather tackle removing individual panels separately and focus here on the Featured Image itself
Good suggestion, I’ll give that a try. |
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.
All good, it’s exactly what I thought about. Let’s add docs and get it in!
77a4366
to
904658a
Compare
@danielbachhuber opened a PR - danielbachhuber/gutenberg-migration-guide#8 @gziolo took a pass at adding a readme for the component, is this what you had in mind? |
return ( | ||
wp.element.createElement( | ||
'div', | ||
{ key: 'outer' + Math.random() }, |
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.
This is confusing to use random
here. I think you don't need it at all. I also wanted to note that you probably can refactor it as:
const el = wp.element.createElement;
el(
'div',
{},
'Prepend above',
el( OriginalComponent, props ),
'Append below'
)
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.
right, that was bad! thanks for fixing that and cleanup generally.
c9a48b4
to
a7f4269
Compare
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.
@adamsilverstein thanks for working on this one, I updated docs to follow other examples. In other files we use ES.Next but I personally prefer to have all the examples using filters to use ES5 so you could paste them in the JS console.
For sure that is great, thanks for updating those examples! |
Description
Enables developers to change what is displayed for the post's featured image panel, or append to it.
Fixes #6533.
Similar to the current core
admin_post_thumbnail_html
filter, this enables filtering of the featured image component.How has this been tested?
Using the console, I tested replacing and appending to the panel.
Replacing the panel
Appending to the panel
Screenshots
Types of changes
Filters the FeaturedImage component.
Checklist: