-
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
How to replace the Document Settings panels or controls? #6533
Comments
It's not supported yet. We have just agreed how to add controls in the Document Settings sidebar in #6300. We didn't discuss removing or replacing the existing panels and control. @mtias @adamsilverstein and @ryanwelcher any thoughts? |
Making the |
A slot here to match the existing functionality makes sense to me, any suggestions for naming that best aligns with describing the purpose of the slot? |
Something along the lines of One thing I was wondering was, and this may just be my level of knowledge of how slotFill works, how would it be used to completely replace the slot as opposed to adding to it? |
@ryanwelcher, technically it appends items, but we can always look for alternative solutions. @aduth should have the best overview what would be the way to go here. |
Wrapping the |
@adamsilverstein yes, withFilters would do the job. What is the most common use case? To replace this part entirely, to prepend or append your own logic? |
In my experience the most common use case is appending additional information/UI below the featured image. @themenow - what was your use case when you opened the ticket, how do you use |
@adamsilverstein I use the filter to replace the image selector entirely with multiple featured images and also adds extra options like image link, lightbox, image filter, etc. |
@gziolo Perhaps withFiltered is best here vs a slot since replacement is clearly a use case. With the filtering a approach appending would also be an option. |
Yes, |
I am the original author of the request of #6225 - which sent me here. As the title states, the solution will hopefully work not only for the featured image panel, but universally. I need it for the "tags" panel. |
#6940 offers a solution to replace or wrap featured image contents. We still need to find a way to offer more control over which panels should be displayed. |
What's the status of this one? |
This one is possible in Gutenberg with
Let's close this one and tackle each panel separately when there is a use case we can discuss in details. I'm also linking this PR where we plan to update documentation related to editor hooks: #11099. |
This doesn't seem to support removal of the "Authors" panel, similar to:
I'd expect this to be possible with something like:
It looks like this isn't possible based on what I see in the pull request commits, documentation and tests. |
@noisysocks, do you happen to know how it would have to be structured for meta boxes? |
@gziolo: Sorry, I'm not sure what you mean. How would what have to be structured? A third party meta box can be disabled by unregistering it in PHP with To my knowledge, this Author field in Gutenberg can't be disabled: It appears when the current post type has |
@noisysocks if I'm understanding your comment above, does that mean there is no way for a plugin (even a VIP plugin) like Co-Authors-Plus (for example) to remove/hide the Author field (it currently uses |
The
While
These are not all relevant to Gutenberg, but more than 5 certainly are. |
Kevin you're definitely a life saver! RemoveEditorPanel function works perfectly to remove panels. I'm using custom Featured Image and Page Attributes meta boxes in my themes and needed to remove both core components. Remove "featured-image" helped to remove Featured Image panel but I wasn't able to remove Page Attributes. Then I realized Featured Image panel can be removed by calling "postimagediv" with PHP remove_meta_box() function. Yet "featured-image" must be used with Gutenberg. That being said apparently core element names have been changed. I simply tried using "page-attributes" instead of "pageparentdiv" and surprisingly Page Attributes component removed :
I haven't tried to remove other components but it seems using component names in lowercase might be a good start (until WordPress releases official documentation!) I've just wanted to thank you and post this solution in case it helps someone. |
@chrisvanpatten - it would be nice to include the information about how to remove those panels in Gutenberg docs. We should also clarify the support for We also added support for |
It'a also worth clarifing that removeEditorPanel( `taxonomy-panel-${ taxonomySlug }` ); should be equivalent to:
|
I also need to remove the Page Attributes panel on Gutenberg editor. const { removeEditorPanel } = wp.data.dispatch('core/edit-post'); removeEditorPanel( 'page-attributes' ); Thanks. |
@nuno46 In a plugin I simply execute after the document has loaded (JavaScript added inline into the page) (In my plugin I actually remove the panel 'taxonomy-panel-post_tag'.) |
Thanks Christoph (ecobux), I don't know how to do that, I added a plugin to add JS code, and added the code, but nothing changes. I am sure is my fault... |
@nuno46 Please contact me per email at christoph (at sign) chattymango (dot) com |
tagsdiv-{$tax-name} did not work for me. Using taxonomy-panel-TAXONOMY-NAME did work as described here. |
Issue Overview
I can replace the Featured Image control in current WP version by PHP:
add_filter( 'admin_post_thumbnail_html', 'my_admin_post_thumbnail_html', 10, 2 );
How do I do the same thing with Gutenberg?
The text was updated successfully, but these errors were encountered: