Skip to content
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

[4.x] Add form reference to field during render #8862

Merged

Conversation

martyf
Copy link
Contributor

@martyf martyf commented Oct 18, 2023

The RendersForms concern handles the rendering of fields.

However within a field's context during render, the field has no knowledge of the form it is being used on.

This PR updates the getRenderableField method of RendersForms to add the form to the Field (only if the form method exists).

This can be useful to help give the fieldtype rendering context as to what form it is belonging to.

For a custom fieldtype, developers can use $this->field()->form() within their fieldtype to get the form instance.

@jasonvarga jasonvarga merged commit 0e0b484 into statamic:4.x Oct 18, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants