task: #3618889 Declare initial preprocess and call the preprocess service classes Drupal 12 moved the procedural functions into

Drupal 12 removes the theme hook includes mechanism, and WebformThemeHooks::theme() sets file on every hook, so includes/webform.theme.template.inc is never loaded there and none of its 31 template_preprocess_*() functions is discovered. The result is that every webform renders as an empty <form> with no children, no actions and no action/method/id/accept-charset attributes, and nothing is logged.

Adds Drupal\webform\Theme\WebformPreprocess with one method per preprocess function, and declares initial preprocess for each hook that has one. The file key stays alongside it, because initial preprocess only exists from Drupal 11.2 and webform still supports 10.3, where the unknown key is ignored. No service registration is needed: the CallableResolver resolves Class:method against the auto-registered service named after the class.

Also bridges the second half of the same removal. template_preprocess_webform() called the removed procedural template_preprocess_form(), whose body is now Drupal\Core\Form\FormPreprocess::preprocessForm(), and webform_share called template_preprocess_html() and template_preprocess_page(), now on Drupal\Core\Theme\ThemePreprocess. Each call site keeps the procedural path where the function still exists, so Drupal 10.3 through 11.x behave exactly as before.

Verified against core 12.x-dev on a contrib project's next-major CI lane, since webform has no Drupal 12 lane of its own: seven test classes that could not run there before now run, giving 989 passing with 0 failures, 0 errors and 0 skips. Proving it took two wrong theories first, both recorded on the issue, because the symptom carries no error message.

Not included, and noted under Remaining tasks on the issue: the change record also suggests moving each preprocess body into the class and dropping file, which has to wait until webform requires 11.2 or later; and core 12's preprocessForm() adds novalidate unless enable_html5_validation is set, which is left out so behavior on supported releases does not change.

Merge request reports

Loading
Loading