Need documentation for the theme process/preprocess functions

Created on 13 January 2011, over 13 years ago
Updated 25 June 2023, about 1 year ago

As a follow-up to #1021270: Blocks for custom menus are impossible to theme β†’ , I realize that we need documentation for at least some of the preprocess/process theme functions that a module/theme can define. There's a list of such functions on the theme() doc page:
http://api.drupal.org/api/drupal/includes--theme.inc/function/theme/7

The specific thing that came up in the issue referenced above is that we need to document that the template suggestions in template_preprocess_HOOK() should only contain hyphens -- and in fact, we need to document that this is the place to make template suggestions.

Suggested wording is something like this:

Hyphens and underscores play a special role in theme suggestions. Theme suggestions should only contain underscores, because within drupal_find_theme_templates(), underscores are converted to hyphens to match template file names, and then converted back to hyphens to match pre-processing and other function names. So if your theme suggestion contains a hyphen, it will end up as an underscore after this conversion, and your function names won't be recognized.

πŸ“Œ Task
Status

Closed: outdated

Version

9.5

Component
DocumentationΒ  β†’

Last updated less than a minute ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States jhodgdon Spokane, WA, USA

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since there has been no follow up ot #15 closing out as outdated.

    If still a valid task please reopen updating issue summary and addressing #15

    Thanks!

Production build 0.71.5 2024