Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#41198 closed defect (bug) (fixed)

Reference dynamic hooks in doc blocks, e.g. archive_template -> {$type}_template

Reported by: donutz Owned by: DrewAPicture
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: docs Cc:
PR Number:

Change History (7)

This ticket was mentioned in Slack in #docs by diggy. View the logs.

3 years ago

#2 @DrewAPicture
3 years ago

  • Focuses docs added
  • Type changed from enhancement to defect (bug)

You're correct that these hooks are permutations of dynamic hooks, but they actually shouldn't be getting parsed in the first place – which is a bug – rather, they should be marked as duplicates of the dynamic hooks.

#3 @DrewAPicture
3 years ago

In this case, we just need to change the inline hook references to point to the right place.

#4 @DrewAPicture
3 years ago

In 40962:

Docs: Don't reference non-existent hooks inline in the DocBlock description for get_post_type_archive_template().

Props milana_cap.
See #41198.

#5 @DrewAPicture
3 years ago

  • Milestone changed from Awaiting Review to 4.9

#6 @DrewAPicture
3 years ago

In 40963:

Docs: Don't reference non-existent hooks inline in the DocBlock description for get_archive_template().

Also removes extra curly braces from the dynamic hook references added in [40962] to aid future re-parsing.

See #41198.

#7 @DrewAPicture
3 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from new to closed

In 40964:

Docs: Don't reference non-existent hooks inline in the DocBlock descriptions for the following template functions:

  • get_index_template()
  • get_404_template()
  • get_author_template()
  • get_category_template()
  • get_tag_template()
  • get_taxonomy_template()
  • get_date_template()
  • get_home_template()
  • get_front_page_template()
  • get_page_template()
  • get_search_template()
  • get_single_template()
  • get_embed_template()
  • get_singular_template()
  • get_attachment_template()

As mentioned when these dynamic hook references were originally fixed in [33274], we can't link to non-existent hooks inline because the Code Reference auto-linker won't pick up on the dynamic-ness of the hook, it'll just try to link to a hook reference that doesn't exist. In these cases, we need to be generic and provide context for the value of $type.

See [38418] for where the original fix was reversed. See this changeset for reversing the reversal.

Props donutz, milana_cap.

Fixes #41198.

Note: See TracTickets for help on using tickets.