Allow form operation and form state arguments to be overridden in add form

Created on 21 November 2023, 12 months ago
Updated 8 December 2023, 11 months ago

Problem/Motivation

We need to pass variables to the form state arguments to initialize fields on an add message form. So if a message has a reference field pointing to a node, we want to pass that node id into the form state arguments so that the reference field value can by initialized in `hook_entity_prepare_form()`. This requires taking an optional parameter in MessageController->add() to pass the field for programmatically created forms.

Additionally, as more applications override form modes, it is useful to allow an optional parameter to alter the form mode ($operation).

Proposed resolution

Patch included. This patch should not affect site builders. It may affect developers who have extended MessageController class and overriden the add() method.

API changes

MessageController->add() will add two new function parameters, both optional with default values.

✨ Feature request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada dtarc

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

Comments & Activities

Production build 0.71.5 2024