From 9a84505d762a958fa2350cc1d6f1de6457ec5221 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Mon, 5 May 2025 16:05:07 -0400 Subject: [PATCH 01/11] extract create/update form buttons into their own partials --- .../formcontroller/views/create/_sidebar.php | 27 +------------ .../formcontroller/views/create/_standard.php | 27 +------------ .../create/sidebar/_form_create_toolbar.php | 26 ++++++++++++ .../create/standard/_form_create_toolbar.php | 26 ++++++++++++ .../formcontroller/views/update/_sidebar.php | 40 +------------------ .../formcontroller/views/update/_standard.php | 38 +----------------- .../update/sidebar/_form_update_toolbar.php | 39 ++++++++++++++++++ .../update/standard/_form_update_toolbar.php | 37 +++++++++++++++++ 8 files changed, 132 insertions(+), 128 deletions(-) create mode 100644 modules/backend/behaviors/formcontroller/views/create/sidebar/_form_create_toolbar.php create mode 100644 modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php create mode 100644 modules/backend/behaviors/formcontroller/views/update/sidebar/_form_update_toolbar.php create mode 100644 modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php diff --git a/modules/backend/behaviors/formcontroller/views/create/_sidebar.php b/modules/backend/behaviors/formcontroller/views/create/_sidebar.php index 2e65cdf8bb..3eabe5d65e 100644 --- a/modules/backend/behaviors/formcontroller/views/create/_sidebar.php +++ b/modules/backend/behaviors/formcontroller/views/create/_sidebar.php @@ -11,32 +11,7 @@
-
- - - - - -
+ makePartial('form_create_toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/create/_standard.php b/modules/backend/behaviors/formcontroller/views/create/_standard.php index 45a39802f7..837f10b19f 100644 --- a/modules/backend/behaviors/formcontroller/views/create/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/create/_standard.php @@ -13,32 +13,7 @@
-
- - - - - -
+ makePartial('form_create_toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/create/sidebar/_form_create_toolbar.php b/modules/backend/behaviors/formcontroller/views/create/sidebar/_form_create_toolbar.php new file mode 100644 index 0000000000..89047ff0b4 --- /dev/null +++ b/modules/backend/behaviors/formcontroller/views/create/sidebar/_form_create_toolbar.php @@ -0,0 +1,26 @@ +
+ + + + + +
diff --git a/modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php b/modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php new file mode 100644 index 0000000000..89047ff0b4 --- /dev/null +++ b/modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php @@ -0,0 +1,26 @@ +
+ + + + + +
diff --git a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php index 75ac048f69..36ebc9e1e8 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php +++ b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php @@ -11,45 +11,7 @@
-
- - - - - - - -
+ makePartial('form_update_toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/_standard.php b/modules/backend/behaviors/formcontroller/views/update/_standard.php index b9327585a2..6b6c744e99 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/update/_standard.php @@ -13,43 +13,7 @@
-
- - - - - - -
+ makePartial('form_update_toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/sidebar/_form_update_toolbar.php b/modules/backend/behaviors/formcontroller/views/update/sidebar/_form_update_toolbar.php new file mode 100644 index 0000000000..8a63881802 --- /dev/null +++ b/modules/backend/behaviors/formcontroller/views/update/sidebar/_form_update_toolbar.php @@ -0,0 +1,39 @@ +
+ + + + + + + +
diff --git a/modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php b/modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php new file mode 100644 index 0000000000..568e1a38aa --- /dev/null +++ b/modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php @@ -0,0 +1,37 @@ +
+ + + + + + +
From 4ce58f1897454ba220e970efbb2f3701505ec220 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 6 May 2025 14:13:49 -0400 Subject: [PATCH 02/11] improve form buttons --- modules/backend/behaviors/FormController.php | 4 ++ .../behaviors/formcontroller/views/create.php | 1 + ...m_create_toolbar.php => _form_toolbar.php} | 11 ++++++ .../formcontroller/views/create/_sidebar.php | 2 +- .../formcontroller/views/create/_standard.php | 2 +- .../create/standard/_form_create_toolbar.php | 26 ------------- .../behaviors/formcontroller/views/update.php | 1 + ...m_update_toolbar.php => _form_toolbar.php} | 0 .../formcontroller/views/update/_sidebar.php | 2 +- .../formcontroller/views/update/_standard.php | 2 +- .../update/standard/_form_update_toolbar.php | 37 ------------------- modules/backend/lang/en/lang.php | 1 + modules/backend/lang/es/lang.php | 1 + modules/backend/lang/fr/lang.php | 1 + modules/backend/lang/nl/lang.php | 1 + modules/backend/lang/pl/lang.php | 1 + modules/backend/lang/ru/lang.php | 1 + 17 files changed, 27 insertions(+), 67 deletions(-) rename modules/backend/behaviors/formcontroller/views/create/{sidebar/_form_create_toolbar.php => _form_toolbar.php} (70%) delete mode 100644 modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php rename modules/backend/behaviors/formcontroller/views/update/{sidebar/_form_update_toolbar.php => _form_toolbar.php} (100%) delete mode 100644 modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index ae58bb475f..2330903c39 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -473,6 +473,10 @@ public function makeRedirect($context = null, $model = null) return Redirect::refresh(); } + if (post('new', false)) { + return Redirect::to($this->controller->actionUrl('create')); + } + if (post('redirect', true)) { $redirectUrl = $this->controller->formGetRedirectUrl($context, $model); } diff --git a/modules/backend/behaviors/formcontroller/views/create.php b/modules/backend/behaviors/formcontroller/views/create.php index 308d711d6b..33a5033012 100644 --- a/modules/backend/behaviors/formcontroller/views/create.php +++ b/modules/backend/behaviors/formcontroller/views/create.php @@ -19,6 +19,7 @@ // Define layout mode view path for inclusion $this->appendViewPath(sprintf('%s/create/%s', __DIR__, $layout)); +$this->appendViewPath(sprintf('%s/create', __DIR__)); // Render the form layout echo $this->makePartial(sprintf('create/%s.php', $layout), [ diff --git a/modules/backend/behaviors/formcontroller/views/create/sidebar/_form_create_toolbar.php b/modules/backend/behaviors/formcontroller/views/create/_form_toolbar.php similarity index 70% rename from modules/backend/behaviors/formcontroller/views/create/sidebar/_form_create_toolbar.php rename to modules/backend/behaviors/formcontroller/views/create/_form_toolbar.php index 89047ff0b4..8840a35561 100644 --- a/modules/backend/behaviors/formcontroller/views/create/sidebar/_form_create_toolbar.php +++ b/modules/backend/behaviors/formcontroller/views/create/_form_toolbar.php @@ -1,4 +1,15 @@
+
diff --git a/modules/backend/behaviors/formcontroller/views/create/_standard.php b/modules/backend/behaviors/formcontroller/views/create/_standard.php index 837f10b19f..fa784d593c 100644 --- a/modules/backend/behaviors/formcontroller/views/create/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/create/_standard.php @@ -13,7 +13,7 @@
- makePartial('form_create_toolbar', ['formConfig' => $formConfig]) ?> + makePartial('form_toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php b/modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php deleted file mode 100644 index 89047ff0b4..0000000000 --- a/modules/backend/behaviors/formcontroller/views/create/standard/_form_create_toolbar.php +++ /dev/null @@ -1,26 +0,0 @@ -
- - - - - -
diff --git a/modules/backend/behaviors/formcontroller/views/update.php b/modules/backend/behaviors/formcontroller/views/update.php index fe9fe58210..170b7e0f51 100644 --- a/modules/backend/behaviors/formcontroller/views/update.php +++ b/modules/backend/behaviors/formcontroller/views/update.php @@ -19,6 +19,7 @@ // Define layout mode view path for inclusion $this->appendViewPath(sprintf('%s/update/%s', __DIR__, $layout)); +$this->appendViewPath(sprintf('%s/update', __DIR__)); // Render the form layout echo $this->makePartial(sprintf('update/%s.php', $layout), [ diff --git a/modules/backend/behaviors/formcontroller/views/update/sidebar/_form_update_toolbar.php b/modules/backend/behaviors/formcontroller/views/update/_form_toolbar.php similarity index 100% rename from modules/backend/behaviors/formcontroller/views/update/sidebar/_form_update_toolbar.php rename to modules/backend/behaviors/formcontroller/views/update/_form_toolbar.php diff --git a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php index 36ebc9e1e8..1af2e302d2 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php +++ b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php @@ -11,7 +11,7 @@
- makePartial('form_update_toolbar', ['formConfig' => $formConfig]) ?> + makePartial('form_toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/_standard.php b/modules/backend/behaviors/formcontroller/views/update/_standard.php index 6b6c744e99..fa784d593c 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/update/_standard.php @@ -13,7 +13,7 @@
- makePartial('form_update_toolbar', ['formConfig' => $formConfig]) ?> + makePartial('form_toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php b/modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php deleted file mode 100644 index 568e1a38aa..0000000000 --- a/modules/backend/behaviors/formcontroller/views/update/standard/_form_update_toolbar.php +++ /dev/null @@ -1,37 +0,0 @@ -
- - - - - - -
diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index 92888d965d..2645960d33 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -265,6 +265,7 @@ 'not_found' => 'Form record with an ID of :id could not be found.', 'action_confirm' => 'Are you sure?', 'create' => 'Create', + 'create_and_new' => 'Create and new', 'create_and_close' => 'Create and close', 'creating' => 'Creating...', 'creating_name' => 'Creating :name...', diff --git a/modules/backend/lang/es/lang.php b/modules/backend/lang/es/lang.php index c10026cf7f..9a06c3719a 100644 --- a/modules/backend/lang/es/lang.php +++ b/modules/backend/lang/es/lang.php @@ -195,6 +195,7 @@ 'not_found' => 'El registro del formulario con un ID de :id no se pudo encontrar.', 'action_confirm' => '¿Está usted seguro?', 'create' => 'Crear', + 'create_and_new' => 'Crear y nuevo', 'create_and_close' => 'Crear y cerrar', 'creating' => 'Creando...', 'creating_name' => 'Creando :name...', diff --git a/modules/backend/lang/fr/lang.php b/modules/backend/lang/fr/lang.php index 251d800c18..ef499132bf 100644 --- a/modules/backend/lang/fr/lang.php +++ b/modules/backend/lang/fr/lang.php @@ -263,6 +263,7 @@ 'not_found' => 'Aucun enregistrement de formulaire ne correspond à l\'ID :id.', 'action_confirm' => 'Confirmer l\'action ?', 'create' => 'Créer', + 'create_and_new' => 'Créer et nouveau', 'create_and_close' => 'Créer et fermer', 'creating' => 'Création en cours…', 'creating_name' => 'Création d\'un(e) :name en cours…', diff --git a/modules/backend/lang/nl/lang.php b/modules/backend/lang/nl/lang.php index 425a3f4c10..52495bb734 100644 --- a/modules/backend/lang/nl/lang.php +++ b/modules/backend/lang/nl/lang.php @@ -259,6 +259,7 @@ 'not_found' => 'Het formulier met record ID :id is niet gevonden.', 'action_confirm' => 'Weet je het zeker?', 'create' => 'Maken', + 'create_and_new' => 'Maken en nieuw', 'create_and_close' => 'Maken en sluiten', 'creating' => 'Maken...', 'creating_name' => ':name maken...', diff --git a/modules/backend/lang/pl/lang.php b/modules/backend/lang/pl/lang.php index 1e9a18a5d0..8d47307cd1 100644 --- a/modules/backend/lang/pl/lang.php +++ b/modules/backend/lang/pl/lang.php @@ -253,6 +253,7 @@ 'not_found' => 'Rekord formularza o ID :id nie został znaleziony.', 'action_confirm' => 'Czy jesteś pewny?', 'create' => 'Stwórz', + 'create_and_new' => 'Utwórz i nowe', 'create_and_close' => 'Stwórz i zamknij', 'creating' => 'Tworzenie...', 'creating_name' => 'Tworzenie :name...', diff --git a/modules/backend/lang/ru/lang.php b/modules/backend/lang/ru/lang.php index 828f5e1b52..ec071a9590 100644 --- a/modules/backend/lang/ru/lang.php +++ b/modules/backend/lang/ru/lang.php @@ -264,6 +264,7 @@ 'not_found' => 'Форма записи с идентификатором :ID не найдена.', 'action_confirm' => 'Вы уверены, что хотите сделать это?', 'create' => 'Создать', + 'create_and_new' => 'Создать и новый', 'create_and_close' => 'Создать и закрыть', 'creating' => 'Создание...', 'creating_name' => 'Создание :name...', From 2e1cc7ce1d557dfdfeaf816b27a8b1d2bebaf628 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 6 May 2025 15:40:46 -0400 Subject: [PATCH 03/11] allow context to be specified in controller partial override --- modules/backend/behaviors/FormController.php | 17 +++++++++++++++++ .../formcontroller/views/create/_sidebar.php | 2 +- .../formcontroller/views/create/_standard.php | 2 +- .../create/{_form_toolbar.php => _toolbar.php} | 0 .../formcontroller/views/update/_sidebar.php | 2 +- .../formcontroller/views/update/_standard.php | 2 +- .../update/{_form_toolbar.php => _toolbar.php} | 0 7 files changed, 21 insertions(+), 4 deletions(-) rename modules/backend/behaviors/formcontroller/views/create/{_form_toolbar.php => _toolbar.php} (100%) rename modules/backend/behaviors/formcontroller/views/update/{_form_toolbar.php => _toolbar.php} (100%) diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index 2330903c39..915f567e49 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -886,4 +886,21 @@ public static function extendFormFields($callback) call_user_func_array($callback, [$widget, $widget->model, $widget->getContext()]); }); } + + /** + * Controller accessor for making partials within this behavior. + * @param string $partial + * @param array $params + * @return string Partial contents + */ + public function formMakePartial($partial, $params = []) + { + $contents = $this->controller->makePartial('form_'.$this->context.'_'.$partial, $params + $this->vars, false); + if (!$contents) { + $contents = $this->controller->makePartial($partial, $params); + } + + return $contents; + } + } diff --git a/modules/backend/behaviors/formcontroller/views/create/_sidebar.php b/modules/backend/behaviors/formcontroller/views/create/_sidebar.php index 1af2e302d2..7912cc2cc1 100644 --- a/modules/backend/behaviors/formcontroller/views/create/_sidebar.php +++ b/modules/backend/behaviors/formcontroller/views/create/_sidebar.php @@ -11,7 +11,7 @@
- makePartial('form_toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/create/_standard.php b/modules/backend/behaviors/formcontroller/views/create/_standard.php index fa784d593c..5134bcf371 100644 --- a/modules/backend/behaviors/formcontroller/views/create/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/create/_standard.php @@ -13,7 +13,7 @@
- makePartial('form_toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/create/_form_toolbar.php b/modules/backend/behaviors/formcontroller/views/create/_toolbar.php similarity index 100% rename from modules/backend/behaviors/formcontroller/views/create/_form_toolbar.php rename to modules/backend/behaviors/formcontroller/views/create/_toolbar.php diff --git a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php index 1af2e302d2..7912cc2cc1 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php +++ b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php @@ -11,7 +11,7 @@
- makePartial('form_toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/_standard.php b/modules/backend/behaviors/formcontroller/views/update/_standard.php index fa784d593c..5134bcf371 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/update/_standard.php @@ -13,7 +13,7 @@
- makePartial('form_toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar', ['formConfig' => $formConfig]) ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/_form_toolbar.php b/modules/backend/behaviors/formcontroller/views/update/_toolbar.php similarity index 100% rename from modules/backend/behaviors/formcontroller/views/update/_form_toolbar.php rename to modules/backend/behaviors/formcontroller/views/update/_toolbar.php From 545dd0bc873457bbfb2465bd92c522fe74d5e0d8 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 6 May 2025 15:42:49 -0400 Subject: [PATCH 04/11] remove empty line --- modules/backend/behaviors/FormController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index 915f567e49..481c9d5f30 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -902,5 +902,4 @@ public function formMakePartial($partial, $params = []) return $contents; } - } From 9d44f29a38802ed58b7040a5cdcb28656eb52cd9 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 7 May 2025 00:11:34 -0400 Subject: [PATCH 05/11] simplify views; add formConfig to controller vars --- modules/backend/behaviors/FormController.php | 4 +- .../formcontroller/partials/_toolbar.php | 79 +++++++++++++++++++ .../behaviors/formcontroller/views/create.php | 10 +-- .../formcontroller/views/create/_sidebar.php | 2 +- .../formcontroller/views/create/_standard.php | 2 +- .../formcontroller/views/create/_toolbar.php | 37 --------- .../behaviors/formcontroller/views/update.php | 9 +-- .../formcontroller/views/update/_sidebar.php | 2 +- .../formcontroller/views/update/_standard.php | 2 +- .../formcontroller/views/update/_toolbar.php | 39 --------- 10 files changed, 88 insertions(+), 98 deletions(-) create mode 100644 modules/backend/behaviors/formcontroller/partials/_toolbar.php delete mode 100644 modules/backend/behaviors/formcontroller/views/create/_toolbar.php delete mode 100644 modules/backend/behaviors/formcontroller/views/update/_toolbar.php diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index 481c9d5f30..dcb95f5bd8 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -191,7 +191,9 @@ public function initForm($model, $context = null) protected function prepareVars($model) { $this->controller->vars['formModel'] = $model; + $this->controller->vars['formConfig'] = $this->getConfig(); $this->controller->vars['formContext'] = $this->formGetContext(); + $this->controller->vars['formController'] = $this; $this->controller->vars['formRecordName'] = Lang::get($this->getConfig('name', 'backend::lang.model.name')); } @@ -897,7 +899,7 @@ public function formMakePartial($partial, $params = []) { $contents = $this->controller->makePartial('form_'.$this->context.'_'.$partial, $params + $this->vars, false); if (!$contents) { - $contents = $this->controller->makePartial($partial, $params); + $contents = $this->makePartial($partial, $params); } return $contents; diff --git a/modules/backend/behaviors/formcontroller/partials/_toolbar.php b/modules/backend/behaviors/formcontroller/partials/_toolbar.php new file mode 100644 index 0000000000..5bbd3acc98 --- /dev/null +++ b/modules/backend/behaviors/formcontroller/partials/_toolbar.php @@ -0,0 +1,79 @@ + +
+ + + + + + +
+ +
+ + + + + + + +
+ diff --git a/modules/backend/behaviors/formcontroller/views/create.php b/modules/backend/behaviors/formcontroller/views/create.php index 33a5033012..12080a6fc8 100644 --- a/modules/backend/behaviors/formcontroller/views/create.php +++ b/modules/backend/behaviors/formcontroller/views/create.php @@ -1,9 +1,5 @@ getClassExtension(\Backend\Behaviors\FormController::class); -$formConfig = $formController->getConfig(); - // Decide which layout we should be rendering $layout = $this->formLayout ?? $formConfig->formLayout ?? null; if (!in_array($layout, ['standard', 'sidebar', 'fancy'])) { @@ -19,10 +15,6 @@ // Define layout mode view path for inclusion $this->appendViewPath(sprintf('%s/create/%s', __DIR__, $layout)); -$this->appendViewPath(sprintf('%s/create', __DIR__)); // Render the form layout -echo $this->makePartial(sprintf('create/%s.php', $layout), [ - 'formController' => $formController, - 'formConfig' => $formConfig, -]); +echo $this->makePartial(sprintf('create/%s.php', $layout)); diff --git a/modules/backend/behaviors/formcontroller/views/create/_sidebar.php b/modules/backend/behaviors/formcontroller/views/create/_sidebar.php index 7912cc2cc1..f278789de0 100644 --- a/modules/backend/behaviors/formcontroller/views/create/_sidebar.php +++ b/modules/backend/behaviors/formcontroller/views/create/_sidebar.php @@ -11,7 +11,7 @@
- formMakePartial('toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar') ?>
diff --git a/modules/backend/behaviors/formcontroller/views/create/_standard.php b/modules/backend/behaviors/formcontroller/views/create/_standard.php index 5134bcf371..7b88ff8b33 100644 --- a/modules/backend/behaviors/formcontroller/views/create/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/create/_standard.php @@ -13,7 +13,7 @@
- formMakePartial('toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar') ?>
diff --git a/modules/backend/behaviors/formcontroller/views/create/_toolbar.php b/modules/backend/behaviors/formcontroller/views/create/_toolbar.php deleted file mode 100644 index 8840a35561..0000000000 --- a/modules/backend/behaviors/formcontroller/views/create/_toolbar.php +++ /dev/null @@ -1,37 +0,0 @@ -
- - - - - - -
diff --git a/modules/backend/behaviors/formcontroller/views/update.php b/modules/backend/behaviors/formcontroller/views/update.php index 170b7e0f51..1e22df7659 100644 --- a/modules/backend/behaviors/formcontroller/views/update.php +++ b/modules/backend/behaviors/formcontroller/views/update.php @@ -1,9 +1,5 @@ getClassExtension(\Backend\Behaviors\FormController::class); -$formConfig = $formController->getConfig(); - // Decide which layout we should be rendering $layout = $this->formLayout ?? $formConfig->formLayout ?? null; if (!in_array($layout, ['standard', 'sidebar', 'fancy'])) { @@ -22,7 +18,4 @@ $this->appendViewPath(sprintf('%s/update', __DIR__)); // Render the form layout -echo $this->makePartial(sprintf('update/%s.php', $layout), [ - 'formController' => $formController, - 'formConfig' => $formConfig, -]); +echo $this->makePartial(sprintf('update/%s.php', $layout)); diff --git a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php index 7912cc2cc1..f278789de0 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_sidebar.php +++ b/modules/backend/behaviors/formcontroller/views/update/_sidebar.php @@ -11,7 +11,7 @@
- formMakePartial('toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar') ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/_standard.php b/modules/backend/behaviors/formcontroller/views/update/_standard.php index 5134bcf371..7b88ff8b33 100644 --- a/modules/backend/behaviors/formcontroller/views/update/_standard.php +++ b/modules/backend/behaviors/formcontroller/views/update/_standard.php @@ -13,7 +13,7 @@
- formMakePartial('toolbar', ['formConfig' => $formConfig]) ?> + formMakePartial('toolbar') ?>
diff --git a/modules/backend/behaviors/formcontroller/views/update/_toolbar.php b/modules/backend/behaviors/formcontroller/views/update/_toolbar.php deleted file mode 100644 index 8a63881802..0000000000 --- a/modules/backend/behaviors/formcontroller/views/update/_toolbar.php +++ /dev/null @@ -1,39 +0,0 @@ -
- - - - - - - -
From 5bdaa083bf070d803155b42d12f9699cc30e726f Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 7 May 2025 00:16:41 -0400 Subject: [PATCH 06/11] remove last cruft --- .../backend/behaviors/formcontroller/views/preview.php | 8 +------- modules/backend/behaviors/formcontroller/views/update.php | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/modules/backend/behaviors/formcontroller/views/preview.php b/modules/backend/behaviors/formcontroller/views/preview.php index 29d64847e4..1429909ce1 100644 --- a/modules/backend/behaviors/formcontroller/views/preview.php +++ b/modules/backend/behaviors/formcontroller/views/preview.php @@ -1,8 +1,5 @@ getClassExtension(\Backend\Behaviors\FormController::class); -$formConfig = $formController->getConfig(); // Decide which layout we should be rendering $layout = $this->formLayout ?? $formConfig->formLayout ?? null; @@ -21,7 +18,4 @@ $this->appendViewPath(sprintf('%s/preview/%s', __DIR__, $layout)); // Render the form layout -echo $this->makePartial(sprintf('preview/%s.php', $layout), [ - 'formController' => $formController, - 'formConfig' => $formConfig, -]); +echo $this->makePartial(sprintf('preview/%s.php', $layout)); diff --git a/modules/backend/behaviors/formcontroller/views/update.php b/modules/backend/behaviors/formcontroller/views/update.php index 1e22df7659..eb439c1f9a 100644 --- a/modules/backend/behaviors/formcontroller/views/update.php +++ b/modules/backend/behaviors/formcontroller/views/update.php @@ -15,7 +15,6 @@ // Define layout mode view path for inclusion $this->appendViewPath(sprintf('%s/update/%s', __DIR__, $layout)); -$this->appendViewPath(sprintf('%s/update', __DIR__)); // Render the form layout echo $this->makePartial(sprintf('update/%s.php', $layout)); From 7e865e82fee2dc0258d6cf893bb36994312d1360 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 7 May 2025 11:22:29 -0400 Subject: [PATCH 07/11] set modelName once --- .../behaviors/formcontroller/partials/_toolbar.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/backend/behaviors/formcontroller/partials/_toolbar.php b/modules/backend/behaviors/formcontroller/partials/_toolbar.php index 5bbd3acc98..1449b4a326 100644 --- a/modules/backend/behaviors/formcontroller/partials/_toolbar.php +++ b/modules/backend/behaviors/formcontroller/partials/_toolbar.php @@ -1,3 +1,6 @@ +name ?? ''; +?>
- From 40b166d98fa0888dd75877e4dbd715b2edc71a91 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sat, 10 May 2025 00:50:08 -0600 Subject: [PATCH 11/11] Update modules/backend/behaviors/FormController.php --- modules/backend/behaviors/FormController.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/backend/behaviors/FormController.php b/modules/backend/behaviors/FormController.php index 2812915336..1b6c125296 100644 --- a/modules/backend/behaviors/FormController.php +++ b/modules/backend/behaviors/FormController.php @@ -891,11 +891,8 @@ public static function extendFormFields($callback) /** * Controller accessor for making partials within this behavior. - * @param string $partial - * @param array $params - * @return string Partial contents */ - public function formMakePartial($partial, $params = []) + public function formMakePartial(string $partial, array $params = []): string { $contents = $this->controller->makePartial('form_' . $this->context . '_' . $partial, $params + $this->vars, false); if (!$contents) {