8000 [Form] form add extra data by Arkalo2 · Pull Request #20853 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Form] form add extra data #20853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: 6.4
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
referraCode to referralCode
  • Loading branch information
Arkalo2 committed Apr 8, 2025
commit ddfdc728c1b5050ae73ebb59ccb82f0915eadde2
8 changes: 4 additions & 4 deletions forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -988,18 +988,18 @@ The extra fields can be injected like this:
{{ form_row(form.username) }}
{{ form_row(form.email) }}

{# Hidden field to send additional sponsorship code #}
{# Hidden field to send additional referral code #}
<input type="hidden" name="user_create[referralCode]" value="{{ referralCode }}"/>

<button type="submit">Submit</button>
{{ form_end(form) }}

Here, the sponsorship code is an extra field injected at view level.
Here, the referral code is an extra field injected at view level.

You can get the referraCode via ``getExtraData``::
You can get the referral code via ``getExtraData``::

$extraData = $form->getExtraData();
$referraCode = $extraData['referralCode'] ?? null;
$referralCode = $extraData['referralCode'] ?? null;

Learn more
----------
Expand Down
0