Opened 9 years ago
Closed 9 years ago
#35252 closed enhancement (fixed)
Add a `{$taxonomy}_term_edit_form_top` action (similar to the post editing form)
Reported by: | flixos90 | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
I'm proposing to add a new action hook {$taxonomy}_term_edit_form_top
to the term editing form that works similar to the edit_form_top
action on the post editing form. This will allow developers to insert additional content on top of the edit form, just like when editing posts. Currently there is only a {$taxonomy}_pre_edit_form
action which however is executed before the page's wrapper element, so it shouldn't be used to print content.
Concerning the new action, I'm not so much thinking about adding the actual meta fields there (since the term name, slug and description are probably more important and should stay on top), but rather any custom content - in my case for example, I would like to be able to show a custom message to the user if he/she entered a weird value for one of my term meta fields.
I'm gonna upload a patch with my proposed change.
Attachments (2)
Change History (8)
#2
@
9 years ago
- Milestone changed from Awaiting Review to 4.5
- Owner set to boonebgorges
- Status changed from new to assigned
Sure, this seems reasonable.
#3
follow-up:
↓ 4
@
9 years ago
Is there a reason why the action has to be dynamic? If we're passing a taxonomy to it, then the dynamic filter name is redundant. See 35252.2.diff.
#4
in reply to:
↑ 3
;
follow-up:
↓ 5
@
9 years ago
Replying to boonebgorges:
Is there a reason why the action has to be dynamic? If we're passing a taxonomy to it, then the dynamic filter name is redundant. See 35252.2.diff.
Not specifically, I was just looking at the other actions within the form most of which are dynamic, so I applied the same pattern to this new one. But your version is perfectly fine too.
In general however, I wonder which way is preferable. If you want to add something to only specific taxonomies, the dynamic approach is better I think because then you only add the filter where you actually need it - but if you want to add to every one, the way you did it would be easier.
#5
in reply to:
↑ 4
@
9 years ago
Replying to flixos90:
Replying to boonebgorges:
Is there a reason why the action has to be dynamic? If we're passing a taxonomy to it, then the dynamic filter name is redundant. See 35252.2.diff.
Not specifically, I was just looking at the other actions within the form most of which are dynamic, so I applied the same pattern to this new one. But your version is perfectly fine too.
In general however, I wonder which way is preferable. If you want to add something to only specific taxonomies, the dynamic approach is better I think because then you only add the filter where you actually need it - but if you want to add to every one, the way you did it would be easier.
True. I guess all the other actions in this form use the taxonomy name. I'm not a very big fan - it's more confusing to document, and passing the $taxonomy
as an argument rather than as part of the action name gives you lots more flexibility, but I guess we should just go with the flow.
added the new action