From 82377fb7845cd77a9dcb1a3d8d8c688e14b82a63 Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Fri, 17 Jan 2020 16:02:59 -0500 Subject: [PATCH] Move fields into blueprint ... - Because I added the listable field to the blueprint for processing, I hadn't noticed it was also being output in the loop. - Might as well move the rest. Cleans up the vue. --- resources/js/components/fields/Settings.vue | 47 ++----------------- .../CP/Fields/FieldsController.php | 34 +++++++++++++- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/resources/js/components/fields/Settings.vue b/resources/js/components/fields/Settings.vue index b33709b7e3..68c23c45d2 100644 --- a/resources/js/components/fields/Settings.vue +++ b/resources/js/components/fields/Settings.vue @@ -53,53 +53,14 @@ >
- - - - - - - -
diff --git a/src/Http/Controllers/CP/Fields/FieldsController.php b/src/Http/Controllers/CP/Fields/FieldsController.php index fd21391aef..503201e42a 100644 --- a/src/Http/Controllers/CP/Fields/FieldsController.php +++ b/src/Http/Controllers/CP/Fields/FieldsController.php @@ -70,6 +70,38 @@ public function update(Request $request) protected function blueprint($blueprint) { - return $blueprint->ensureField('listable', ['type' => 'select', 'cast_booleans' => true]); + $prepends = collect([ + 'display' => [ + 'type' => 'text', + 'instructions' => __('statamic::messages.fields_display_instructions'), + 'width' => 50, + ], + 'handle' => [ + 'type' => 'text', + 'instructions' => __('statamic::messages.fields_handle_instructions'), + 'width' => 50, + ], + 'instructions' => [ + 'type' => 'text', + 'instructions' => __('statamic::messages.fields_instructions_instructions'), + ], + 'listable' => [ + 'type' => 'select', + 'instructions' => __('statamic::messages.fields_listable_instructions'), + 'cast_booleans' => true, + 'width' => 50, + 'options' => [ + 'hidden' => __('Hidden by default'), + 'true' => __('Yes'), + 'false' => __('No'), + ], + ] + ]); + + foreach ($prepends->reverse() as $handle => $prepend) { + $blueprint->ensureFieldPrepended($handle, $prepend); + } + + return $blueprint; } }