#1766 closed enhancement (fixed)
Handle hook deprecation in the DevHub theme
Reported by: | DrewAPicture | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Developer Hub | Keywords: | has-patch |
Cc: |
Description
In #core10441, the core team is working on adding proper hook deprecation in the form of two new functions: apply_filters_deprecated()
and do_action_deprecated()
.
We'll obviously need to make some adjustments to the parser to properly route the new function calls, but we also might need to adjust some minor things in the DevHub theme, such as ensuring the deprecation callout box can handle a notice for hooks and corresponding replacement hook links.
Looks like we use link_internal_element()
inside of get_deprecated()
to handle linking replacements, so in the interest of simplicity, we might need to add an additional case for hooks referenced simply with 'hook_name'. This would be for the context of deprecated hook docs that look like this:
<?php /** * Some now-deprecated hook. * * @since 2.6.0 * @deprecated 4.6.0 Use 'replacement_hook' instead. * @see 'replacement_hook'
We may very well already be in the clear, but it doesn't hurt to have a tracking ticket here in case there's something we're missing.
1766.diff adds some handling for a few things:
link_internal_element()
that allows us to selectivelypreg_match()
against arbitrary content for a hook reference in the form of 'hook_name'. Currently it only handles inline@see
references, e.g.{@see 'hook_name'}
which come through encoded as‘hook_name’
This is important for handling linking for the deprecated notice, so if we do@see 'hook_name'
as top-level DocBlock tag, it's still possible to parse that as a linkable hook instead of just a string.apply_filters_deprecrated
ordo_action_deprecated
in the reference single page