Convert template preprocess in system.module

Created on 12 April 2025, 10 days ago

Problem/Motivation

See πŸ“Œ [pp-1] Convert Template Preprocess hooks to OOP equivalent Postponed: needs info

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

system.module

Created by

πŸ‡¨πŸ‡­Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @berdir
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Started with the ones directly in the module, there are also some in test modules within system module.

    template_preprocess_layout_test_2col() is tricky, because it's an indirectly defined theme hook through a library definition. We can't add an initial template on that. The question is, do we need to retain that capability, or could we just make this a regular preprocess hook? It would still be possible through a registry alter if you really need to be first. Alternatively, we would need to extend layout definitions.

  • Pipeline finished with Success
    10 days ago
    Total: 1334s
    #471857
  • Pipeline finished with Failed
    10 days ago
    Total: 468s
    #471867
  • Pipeline finished with Failed
    10 days ago
    Total: 571s
    #471885
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Same as the other one. Can the summary be updated about what is being deprecated exactly. Probably need a new CR.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    This is just following the existing deprecation. See the meta issue. There are 100+ of these functions, we do not need a CR for all of them.

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

    The current CR is already published. What if all these don't make it into 11.2 (which may be a real possibility). Are we going to add deprecations to a CR post 11.2. Maybe some grouping can be done but seems like an odd order to publish the CR fully and add to it later. Seems could be confusing too.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    These functions are not an API. While not explicitly listed on https://www.drupal.org/about/core/policies/core-change-policies/bc-polic... β†’ , they are essentially hook implementations and as such excluded from the BC policy IMHO.

    Core just moved thousands of hook implementations without BC in a minor release. We're providing BC for these because it's only about 100 or so, and doesn't came with the same performance concerns as regular hooks.

    Some of the more common ones like container, table and block have some direct calls to them because people sometimes do funky stuff with creative reusage/inheritance of templates and their preprocess logic, but it's pretty rare.

    Note that there is not a single known direct call to any of the functions being deprecated in this issue (http://codcontrib.hank.vps-private.net/search?text=template_preprocess_s...), only a handful of @see references from copy & pasted templates. Nothing changes for those templates, nothing changes for people using #theme => 'xy' in render arrays.

    This is very different from plugin annotation/attributes for example, where each plugin type needed be converted on its own before you could convert them, so it was important to list which was converted when and they got their own CR or at least a grouped one per minor.

    I just think it's easier to apply the same blanket deprecation message to all of them instead of discussing for every single one whether or not we want to do it.

    I also just added this to the linked CR: https://www.drupal.org/node/3504125/revisions/view/13953364/13959196 β†’

    (keeping this at needs work because there's one more in a test module that I want to update anyway)

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Did that last part now, can also copy #7 into the meta issue to provide some more instructions on the approach so this an be distributed, dev days might be a good opportunity for people looking for fairly easy core tasks.

  • Pipeline finished with Success
    7 days ago
    Total: 450s
    #474314
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Still not a fan of adding to a CR after it’s already published, especially if any of these don’t make it before 11.2 but won’t ping pong them around, will leave for others to review

Production build 0.71.5 2024