-
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
Editor: Make the AddTerm Component more reusable #8588
Conversation
- Make it independent from the post - Add the possibility to edit a description on the component refs #8584
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 this out and it is working well. Honestly I like the move away from the middleware solution as it was kind of confusing.
One other item we need to address in making this form friendly to all Taxonomies is to toggle the dispaly of the "Top Level" checkbox, and parent selector depending on if the Taxonomy is hierarchical or not. This can be determined via the call to getPostTypeTaxonomy
which returns the taxonomy object:
<FormLegend> | ||
{ translate( 'Description', { context: 'Terms: Term description label' } ) } | ||
</FormLegend> | ||
<FormTextarea |
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.
In wp-admin the slug
field is also exposed and editable. I'm thinking we should follow suit here, maybe rename showDescriptionInput
to showExtendedInputs
or something and have that conditionally show both description and slug?
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'm not able to edit the slug
in wp-admin. I can see it on the Categories/Tags pages but I'm not able to change it directly. but yes we can change the boolean to showExtendedInputs
.
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 updated the component to handle non-hierarchical taxonomies. I think we can consider merging for now. and we will handle editing once we have the listing.
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.
Ah sorry about that - the slug is editable in core wp-admin, but it appears we have disabled that field on wpcom. Because of that, lets follow suit here as well and do not show the slug field.
We hide the parent selector on non hierarchical taxonomies
@youknowriad just tested this out again on a JP site and WPCOM sites and think it is all working well. Lets get this merged in. |
A user noticed "Can not read hierarchical of null" error when loading the editor This reverts commit 7d6f7a0.
Previously the AddTerm Component was tied with the Post. In this PR, I make it independent. Its new role is just to add a new the term.
I also provide an
onSuccess
callback to potentially add the created term to the edited post (It can be used for anything else).I had also to update to
AddTermForPost
Action Creator to handle only the post edition and attach the term to the edited post. So, we don't need the post middleware anymore since the two actions are now independent.I also added the possibility to enter a description for the created term (will be used for the Term Management Page).
A next step about this issue #8584 is to handle editing terms on the same component.
Testing instructions
cc @timmyc