Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions modules/backend/widgets/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,12 @@ protected function defineFormFields()
* Example usage:
*
* Event::listen('backend.form.extendFieldsBefore', function ((\Backend\Widgets\Form) $formWidget) {
* // You should always check to see if you're extending correct model/controller
* if (!$formWidget->model instanceof \Foo\Example\Models\Bar) {
* // Check that we're extending the correct Form widget instance
* if (
* !($formWidget->getController() instanceof \Winter\User\Controllers\Users)
* || !($formWidget->model instanceof \Winter\User\Models\User)
* || $formWidget->isNested
* ) {
* return;
* }
*
Expand All @@ -518,8 +522,12 @@ protected function defineFormFields()
* Or
*
* $formWidget->bindEvent('form.extendFieldsBefore', function () use ((\Backend\Widgets\Form $formWidget)) {
* // You should always check to see if you're extending correct model/controller
* if (!$formWidget->model instanceof \Foo\Example\Models\Bar) {
* // Check that we're extending the correct Form widget instance
* if (
* !($formWidget->getController() instanceof \Winter\User\Controllers\Users)
* || !($formWidget->model instanceof \Winter\User\Models\User)
* || $formWidget->isNested
* ) {
* return;
* }
*
Expand Down Expand Up @@ -573,13 +581,12 @@ protected function defineFormFields()
* Example usage:
*
* Event::listen('backend.form.extendFields', function ((\Backend\Widgets\Form) $formWidget) {
* // Only for the User controller
* if (!$formWidget->getController() instanceof \Winter\User\Controllers\Users) {
* return;
* }
*
* // Only for the User model
* if (!$formWidget->model instanceof \Winter\User\Models\User) {
* // Check that we're extending the correct Form widget instance
* if (
* !($formWidget->getController() instanceof \Winter\User\Controllers\Users)
* || !($formWidget->model instanceof \Winter\User\Models\User)
* || $formWidget->isNested
* ) {
* return;
* }
*
Expand All @@ -599,13 +606,12 @@ protected function defineFormFields()
* Or
*
* $formWidget->bindEvent('form.extendFields', function () use ((\Backend\Widgets\Form $formWidget)) {
* // Only for the User controller
* if (!$formWidget->getController() instanceof \Winter\User\Controllers\Users) {
* return;
* }
*
* // Only for the User model
* if (!$formWidget->model instanceof \Winter\User\Models\User) {
* // Check that we're extending the correct Form widget instance
* if (
* !($formWidget->getController() instanceof \Winter\User\Controllers\Users)
* || !($formWidget->model instanceof \Winter\User\Models\User)
* || $formWidget->isNested
* ) {
* return;
* }
*
Expand Down