Use CallableResolver for form callbacks

Created on 17 July 2025, 4 months ago

Problem/Motivation

We want to support service callbacks as form callbacks such as submit and validate, so that they can use DI and live in services.

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

forms system

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
  • Merge request !12767use CallableResolver and some example conversions → (Open) created by berdir
  • 🇨🇭Switzerland berdir Switzerland

    Created a quick proof of concept.

    All form callbacks go through FormState::getCallback(), which is nice in that it gives us a single place to adjust, but FormState isn't something we can inject, so we have to use Drupal::service() which I absolutely expect will break some unit tests.

    Might want to deprecate this and add something else.

  • Pipeline finished with Failed
    4 months ago
    Total: 228s
    #550696
  • 🇺🇸United States nicxvan

    Yep a lot of container not initialized yet failures.

  • Pipeline finished with Failed
    4 months ago
    Total: 458s
    #550723
  • Pipeline finished with Failed
    4 months ago
    Total: 4037s
    #550728
  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia

    kim.pepper made their first commit to this issue’s fork.

  • Pipeline finished with Failed
    4 months ago
    Total: 1971s
    #550831
  • 🇨🇭Switzerland berdir Switzerland
  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia

    Added 📌 Move file form hooks to FileFormHooks class Active for the hooks cleanup mentioned above.

  • Pipeline finished with Success
    4 months ago
    Total: 448s
    #553619
  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia

    Fixed the failing test by handling the exception. Not sure if this is the right place to handle it.

  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇦🇺Australia kim.pepper 🏄‍♂️🇦🇺Sydney, Australia

    Rebased on 11.x

  • Pipeline finished with Success
    3 months ago
    #566639
  • Status changed to RTBC 26 days ago
  • Pipeline finished with Failed
    25 days ago
    #626151
  • Pipeline finished with Failed
    25 days ago
    Total: 123s
    #626166
  • Pipeline finished with Failed
    25 days ago
    Total: 254s
    #626173
  • Pipeline finished with Failed
    25 days ago
    Total: 344s
    #626250
  • Pipeline finished with Failed
    25 days ago
    Total: 294s
    #626268
  • Pipeline finished with Failed
    25 days ago
    Total: 1348s
    #626282
  • Pipeline finished with Failed
    25 days ago
    Total: 1431s
    #626292
  • Pipeline finished with Failed
    24 days ago
    Total: 1825s
    #627156
  • Pipeline finished with Failed
    24 days ago
    #627176
  • Pipeline finished with Failed
    24 days ago
    Total: 713s
    #627182
  • Pipeline finished with Running
    24 days ago
    #627186
  • Pipeline finished with Failed
    24 days ago
    Total: 218s
    #627188
  • Pipeline finished with Failed
    24 days ago
    Total: 880s
    #627193
  • Pipeline finished with Failed
    24 days ago
    Total: 255s
    #627290
  • Pipeline finished with Success
    24 days ago
    Total: 736s
    #627308
  • Pipeline finished with Success
    24 days ago
    Total: 892s
    #627348
  • Pipeline finished with Failed
    23 days ago
    Total: 297s
    #628098
  • Pipeline finished with Success
    23 days ago
    Total: 679s
    #628109
  • Pipeline finished with Success
    23 days ago
    Total: 611s
    #628293
  • Pipeline finished with Success
    14 days ago
    Total: 1568s
    #637927
  • Pipeline finished with Canceled
    8 days ago
    Total: 666s
    #643812
  • Pipeline finished with Success
    8 days ago
    Total: 1476s
    #643816
Production build 0.71.5 2024