diff --git a/modules/backend/console/CreateController.php b/modules/backend/console/CreateController.php index bb89184938..1528815323 100644 --- a/modules/backend/console/CreateController.php +++ b/modules/backend/console/CreateController.php @@ -22,6 +22,7 @@ class CreateController extends BaseScaffoldCommand {controller : The name of the controller to generate. (eg: Posts)} {--force : Overwrite existing files with generated files.} {--model= : Defines the model name to use. If not provided, the singular name of the controller is used.} + {--sidebar : Create stubs for form-with-sidebar layout} {--uninspiring : Disable inspirational quotes} '; @@ -47,10 +48,7 @@ class CreateController extends BaseScaffoldCommand 'scaffold/controller/_list_toolbar.stub' => 'controllers/{{lower_name}}/_list_toolbar.php', 'scaffold/controller/config_form.stub' => 'controllers/{{lower_name}}/config_form.yaml', 'scaffold/controller/config_list.stub' => 'controllers/{{lower_name}}/config_list.yaml', - 'scaffold/controller/create.stub' => 'controllers/{{lower_name}}/create.php', 'scaffold/controller/index.stub' => 'controllers/{{lower_name}}/index.php', - 'scaffold/controller/preview.stub' => 'controllers/{{lower_name}}/preview.php', - 'scaffold/controller/update.stub' => 'controllers/{{lower_name}}/update.php', 'scaffold/controller/controller.stub' => 'controllers/{{studly_name}}.php', ]; @@ -69,6 +67,13 @@ protected function prepareVars(): array $model = Str::singular($vars['name']); } $vars['model'] = $model; + $vars['sidebar'] = $this->option('sidebar'); + + $layout = $this->option('sidebar') ? 'sidebar' : 'standard'; + + $this->stubs["scaffold/controller/{$layout}/create.stub"] = 'controllers/{{lower_name}}/create.php'; + $this->stubs["scaffold/controller/{$layout}/update.stub"] = 'controllers/{{lower_name}}/update.php'; + $this->stubs["scaffold/controller/{$layout}/preview.stub"] = 'controllers/{{lower_name}}/preview.php'; return $vars; } diff --git a/modules/backend/console/scaffold/controller/controller.stub b/modules/backend/console/scaffold/controller/controller.stub index 0c5e1f3da9..324a3b3164 100644 --- a/modules/backend/console/scaffold/controller/controller.stub +++ b/modules/backend/console/scaffold/controller/controller.stub @@ -21,5 +21,9 @@ class {{ studly_name }} extends Controller parent::__construct(); BackendMenu::setContext('{{ plugin_code }}', '{{ lower_plugin }}', '{{ lower_name }}'); + {% if sidebar %} + + $this->bodyClass = 'compact-container'; + {% endif -%} } } diff --git a/modules/backend/console/scaffold/controller/sidebar/create.stub b/modules/backend/console/scaffold/controller/sidebar/create.stub new file mode 100644 index 0000000000..cfce78fa9c --- /dev/null +++ b/modules/backend/console/scaffold/controller/sidebar/create.stub @@ -0,0 +1,64 @@ + + + + +fatalError): ?> + + +
+ +
+ formRenderOutsideFields() ?> + formRenderPrimaryTabs() ?> +
+ +
+
+ + + + or + +
+
+ +
+ + + +
formRenderSecondaryTabs() ?>
+ + + + 'layout stretch']) ?> + makeLayout('form-with-sidebar') ?> + + + + +
+ +
+
+

fatalError)) ?>

+

+
+ diff --git a/modules/backend/console/scaffold/controller/sidebar/preview.stub b/modules/backend/console/scaffold/controller/sidebar/preview.stub new file mode 100644 index 0000000000..6014bd4585 --- /dev/null +++ b/modules/backend/console/scaffold/controller/sidebar/preview.stub @@ -0,0 +1,39 @@ + + + + +fatalError): ?> + + +
+ +
+ formRenderOutsideFields() ?> + formRenderPrimaryTabs() ?> +
+ +
+ + + +
formRenderSecondaryTabs() ?>
+ + + + 'layout stretch']) ?> + makeLayout('form-with-sidebar') ?> + + + + +
+ +
+
+

fatalError)) ?>

+

+
+ diff --git a/modules/backend/console/scaffold/controller/sidebar/update.stub b/modules/backend/console/scaffold/controller/sidebar/update.stub new file mode 100644 index 0000000000..bd5677411b --- /dev/null +++ b/modules/backend/console/scaffold/controller/sidebar/update.stub @@ -0,0 +1,72 @@ + + + + +fatalError): ?> + + +
+ +
+ formRenderOutsideFields() ?> + formRenderPrimaryTabs() ?> +
+ +
+
+ + + + + or + +
+
+ +
+ + + +
formRenderSecondaryTabs() ?>
+ + + + 'layout stretch']) ?> + makeLayout('form-with-sidebar') ?> + + + + +
+ +
+
+

fatalError)) ?>

+

+
+ diff --git a/modules/backend/console/scaffold/controller/create.stub b/modules/backend/console/scaffold/controller/standard/create.stub similarity index 100% rename from modules/backend/console/scaffold/controller/create.stub rename to modules/backend/console/scaffold/controller/standard/create.stub diff --git a/modules/backend/console/scaffold/controller/preview.stub b/modules/backend/console/scaffold/controller/standard/preview.stub similarity index 100% rename from modules/backend/console/scaffold/controller/preview.stub rename to modules/backend/console/scaffold/controller/standard/preview.stub diff --git a/modules/backend/console/scaffold/controller/update.stub b/modules/backend/console/scaffold/controller/standard/update.stub similarity index 100% rename from modules/backend/console/scaffold/controller/update.stub rename to modules/backend/console/scaffold/controller/standard/update.stub