From 7b6053768dfc60bdeb5f7d61411370143aa4911b Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Thu, 20 Feb 2020 00:42:51 -0500 Subject: [PATCH] Fix argument name in event handler examples (#4950) --- modules/backend/widgets/Form.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index 9238bb25e..241d8d4ba 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -506,14 +506,14 @@ class Form extends WidgetBase * * Event::listen('backend.form.extendFieldsBefore', function ((\Backend\Widgets\Form) $formWidget) { * // You should always check to see if you're extending correct model/controller - * if (!$widget->model instanceof \Foo\Example\Models\Bar) { + * if (!$formWidget->model instanceof \Foo\Example\Models\Bar) { * return; * } * * // Here you can't use addFields() because it will throw you an exception because form is not yet created * // and it does not have tabs and fields * // For this example we will pretend that we want to add a new field named example_field - * $widget->fields['example_field'] = [ + * $formWidget->fields['example_field'] = [ * 'label' => 'Example field', * 'comment' => 'Your example field', * 'type' => 'text', @@ -524,14 +524,14 @@ class Form extends WidgetBase * * $formWidget->bindEvent('form.extendFieldsBefore', function () use ((\Backend\Widgets\Form $formWidget)) { * // You should always check to see if you're extending correct model/controller - * if (!$widget->model instanceof \Foo\Example\Models\Bar) { + * if (!$formWidget->model instanceof \Foo\Example\Models\Bar) { * return; * } * * // Here you can't use addFields() because it will throw you an exception because form is not yet created * // and it does not have tabs and fields * // For this example we will pretend that we want to add a new field named example_field - * $widget->fields['example_field'] = [ + * $formWidget->fields['example_field'] = [ * 'label' => 'Example field', * 'comment' => 'Your example field', * 'type' => 'text', @@ -579,17 +579,17 @@ class Form extends WidgetBase * * Event::listen('backend.form.extendFields', function ((\Backend\Widgets\Form) $formWidget) { * // Only for the User controller - * if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) { + * if (!$formWidget->getController() instanceof \RainLab\User\Controllers\Users) { * return; * } * * // Only for the User model - * if (!$widget->model instanceof \RainLab\User\Models\User) { + * if (!$formWidget->model instanceof \RainLab\User\Models\User) { * return; * } * * // Add an extra birthday field - * $widget->addFields([ + * $formWidget->addFields([ * 'birthday' => [ * 'label' => 'Birthday', * 'comment' => 'Select the users birthday', @@ -598,24 +598,24 @@ class Form extends WidgetBase * ]); * * // Remove a Surname field - * $widget->removeField('surname'); + * $formWidget->removeField('surname'); * }); * * Or * * $formWidget->bindEvent('form.extendFields', function () use ((\Backend\Widgets\Form $formWidget)) { * // Only for the User controller - * if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) { + * if (!$formWidget->getController() instanceof \RainLab\User\Controllers\Users) { * return; * } * * // Only for the User model - * if (!$widget->model instanceof \RainLab\User\Models\User) { + * if (!$formWidget->model instanceof \RainLab\User\Models\User) { * return; * } * * // Add an extra birthday field - * $widget->addFields([ + * $formWidget->addFields([ * 'birthday' => [ * 'label' => 'Birthday', * 'comment' => 'Select the users birthday', @@ -624,7 +624,7 @@ class Form extends WidgetBase * ]); * * // Remove a Surname field - * $widget->removeField('surname'); + * $formWidget->removeField('surname'); * }); * */