Template:WPBannerMeta/hooks

From Wikibooks, open books for an open world
Jump to navigation Jump to search

WPBannerMeta incorporates a number of 'hooks', where advanced or customized features can be added. These should take the form of a subtemplate passed to the relevant hook parameter. Any relevant parameters should then be passed to the hook template—it may be necessary to repeat parameters that are already passed to the main template (e.g.: |category={{{category|¬}}} and |quality={{{quality|}}} are commonly used). If you write a hook that you think other projects could use, please copy or move it to a subpage here and add it to the list below.

Writing a hook[edit source]

Hooks should be carefully designed to mimic the meta-functionality of the WPBannerMeta template, particularly with things like category opt-out and case-insensitive quality filtering; and for ease of maintenance, the parameters should be similarly named to WPBannerMeta's default parameters.

Available hook parameters[edit source]

  • |HOOK_ASSESS= – between the code for quality and priority assessments.
  • |HOOK_BOTTOM= – just below the comments display, adjacent to |BOTTOM_TEXT=. Please use this hook rather than the |BOTTOM_TEXT= parameter, for adding extra functionality to the bottom of the template.
  • |HOOK_NOTE= – after the last note code (above the comment display).
  • |HOOK_COLLAPSED= – added to the 'counter' that counts the number of notes that have been triggered on a page, to prompt the collapsible box. Accepts either
    • any valid input to the #expr: ParserFunction.
    • "auto", which automatically sets to 1 if HOOK_NOTE is non-empty and 0 otherwise. This is the default setting and is suitable if HOOK_NOTE will not normally produce more than one row of output.
  • |HOOK_PRIORITY= – between the priority assessment and the autoassess notice.
  • |HOOK_NESTED= – after the task force list that is displayed when the banner is nested within a {{WikiProjectBannerShell}}.
  • |HOOK_TF= – after the task force code (just above the code for |attention=).

Existing hooks[edit source]

  • /cats – add categories based on parameters with proper optout, case insensitivity, etc.
  • /notecounter – allows notes, etc. added in HOOK_NOTE to contribute towards the counter that triggers the notes being collapsed.
  • /notes – provides ten additional notes. Hooks to |HOOK_NOTE=.
  • /taskforces – provides ten additional taskforces (hooks to |HOOK_TF=).
  • /tfnested – nested summaries for ten additional taskforces. Works with /taskforces above. Hooks to |HOOK_NESTED=.
  • /todolist – allows for easy adding of a project wide to-do list (hooks to |HOOK_BOTTOM=).