Problem/Motivation

FormBuilder::doBuildForm() resolves #process, #after_build, #submit, #validate, and #entity_builders callbacks through CallableResolver::getCallableFromDefinition(). This lets those callbacks use service notation with dependency injection, added in #3536726: Use CallableResolver for form callbacks.

#value_callback still resolves through plain is_callable() and call_user_func_array(). It cannot use service notation. This blocks converting existing static #value_callback methods into injectable service methods, including ManagedFile::valueCallback() and FileWidget::value(), needed by #3375423: Deprecate file_managed_file_save_upload(), file_save_upload() and _file_save_upload_from_form() and replace with a service and tracked under the meta issue #3221796: [META] Modernise file upload logic.

Steps to reproduce

Proposed resolution

Update the #value_callback handling in FormBuilder::doBuildForm() to call CallableResolver::getCallableFromDefinition(), matching the existing #process and #after_build handling. Existing static and array callables must keep working unchanged. Add a test covering a #value_callback defined in service notation.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3616645

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kim.pepper created an issue. See original summary.

kim.pepper’s picture

Status: Active » Needs review
kim.pepper’s picture

We can probably just add to the existing change record for this issue https://www.drupal.org/node/3548821

nicxvan’s picture

Well that's unfortunate we missed that.

I haven't reviewed this yet, but we can't add this to the existing CR, this won't get in until 11.5 and that CR was for 11.3.

berdir’s picture

Status: Needs review » Needs work

Needs work for the review and CR

kim.pepper’s picture

Status: Needs work » Needs review

Added a CR and addressed review feedback.