From a5d71ae98fc11e0b3ce314b59f8623a8499bf252 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 May 2023 09:07:31 -0400 Subject: [PATCH 1/2] document the new $previewMode variable passed to partial fields --- backend-forms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend-forms.md b/backend-forms.md index 643bcd20..918a8342 100644 --- a/backend-forms.md +++ b/backend-forms.md @@ -649,7 +649,7 @@ For more information on model validation, please visit [the documentation page]( ### Partial -`partial` - renders a partial, the `path` value can refer to a partial view file otherwise the field name is used as the partial name. Inside the partial these variables are available: `$value` is the default field value, `$model` is the model used for the field and `$field` is the configured class object `Backend\Classes\FormField`. +`partial` - renders a partial, the `path` value can refer to a partial view file otherwise the field name is used as the partial name. Inside the partial these variables are available: `$value` is the default field value, `$model` is the model used for the field, `$field` is the configured class object `Backend\Classes\FormField` and `$previewMode` is the previewMode of the parent container (form, repeater or nestedform). ```yaml content: From 9565b4110bb79e1d541d7e112558c50e28f835cd Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 17 May 2023 15:18:24 -0600 Subject: [PATCH 2/2] Update backend-forms.md --- backend-forms.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend-forms.md b/backend-forms.md index 918a8342..40c9fc83 100644 --- a/backend-forms.md +++ b/backend-forms.md @@ -649,7 +649,12 @@ For more information on model validation, please visit [the documentation page]( ### Partial -`partial` - renders a partial, the `path` value can refer to a partial view file otherwise the field name is used as the partial name. Inside the partial these variables are available: `$value` is the default field value, `$model` is the model used for the field, `$field` is the configured class object `Backend\Classes\FormField` and `$previewMode` is the previewMode of the parent container (form, repeater or nestedform). +`partial` - renders a backend partial. If `path` option is not set the field name is used as the partial name when attempting to locate the partial. The following variables are available to the partial being rendered: + +- `$formWidget`: The instance of the `Backend\Widgets\Form` class that this field belongs to +- `$formModel` or `$model`: The instance of the `Model` attached to this form. +- `$formField` or `$field`: The instance of `Backend\Classes\FormField` for this field. +- `$formValue` or `$value`: The value of this field instance. ```yaml content: