Make AutosaveFormBuilder into a true decorator

Created on 3 February 2025, 5 months ago

Problem/Motivation

In the wake of πŸ› Drupal CMS 1.0.1 is not compatible with PHP 8.4 Active , I asked @hchonov in Slack why Autosave Form's FormBuilder both extends and decorates core's FormBuilder. His answer:

see prepareForm
it prevents hooks from being fired
if you have a better solution than this one we can for sure implement it

I do, in fact, think we can accomplish this with a more clean decoration pattern! :) This would be a good thing, because it would significantly decouple Autosave Form from core's internals, which makes it less vulnerable to little tweaks like PHP 8.4-related stuff.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

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

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • Merge request !25Make everything a decorator β†’ (Open) created by phenaproxima
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Canceled
    5 months ago
    Total: 157s
    #413858
  • Pipeline finished with Failed
    5 months ago
    Total: 182s
    #413860
  • Pipeline finished with Failed
    5 months ago
    Total: 167s
    #413872
  • Pipeline finished with Failed
    5 months ago
    Total: 146s
    #413877
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Just stumbled across this looking at another issue. The test failure seems valid:

    InvalidArgumentException: The callable definition provided was invalid. Either class "Drupal\autosave_form\Form\AutosaveFormBuilder" does not have a method "renderPlaceholderFormAction", or it is not callable. in Drupal\Core\Utility\CallableResolver->getCallableFromDefinition() (line 102 of core/lib/Drupal/Core/Utility/CallableResolver.php).

    Is what is shown in the downloaded artifact. The decorator concept is a bit beyond me at the moment (never played with it) but I am guessing we just need to 'decorate' the missing method?

Production build 0.71.5 2024