From f8e9043f344df56255b40a27799e269131a20860 Mon Sep 17 00:00:00 2001 From: edalzell Date: Mon, 4 Jul 2022 21:02:57 -0700 Subject: [PATCH 1/7] config to hide the display --- resources/lang/en/messages.php | 1 + src/Http/Controllers/CP/Fields/FieldsController.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 8e27a31697d..3da9257be6c 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -65,6 +65,7 @@ 'field_validation_required_instructions' => 'Control whether or not this field is required.', 'fields_blueprints_description' => 'Blueprints define the fields for content structures like collections, taxonomies, users, and forms.', 'fields_default_instructions' => 'Set the default value.', + 'fields_hide_display_instructions' => 'Show the display field in the Control Panel?', 'fields_display_instructions' => 'The field\'s label shown in the Control Panel.', 'fields_fieldsets_description' => 'Fieldsets are simple, flexible, and completely optional groupings of fields that help to organize reusable, pre-configured fields.', 'fields_handle_instructions' => 'The field\'s template variable.', diff --git a/src/Http/Controllers/CP/Fields/FieldsController.php b/src/Http/Controllers/CP/Fields/FieldsController.php index 46a08ee4995..d8567a2939d 100644 --- a/src/Http/Controllers/CP/Fields/FieldsController.php +++ b/src/Http/Controllers/CP/Fields/FieldsController.php @@ -86,15 +86,22 @@ protected function blueprint($blueprint) 'display' => __('Display'), 'instructions' => __('statamic::messages.fields_display_instructions'), 'type' => 'text', - 'width' => 50, + 'width' => 33, 'autoselect' => true, ], + 'hide_display' => [ + 'display' => __('Hide Display'), + 'instructions' => __('statamic::messages.fields_hide_display_instructions'), + 'type' => 'toggle', + 'width' => 33, + 'default' => false, + ], 'handle' => [ 'display' => __('Handle'), 'instructions' => __('statamic::messages.fields_handle_instructions'), 'type' => 'text', 'validate' => 'required|not_in:'.implode(',', $reserved), - 'width' => 50, + 'width' => 33, ], 'instructions' => [ 'display' => __('Instructions'), From a7305ad82dd99885575c8055f089518860ab0764 Mon Sep 17 00:00:00 2001 From: edalzell Date: Sun, 14 Aug 2022 20:09:51 -0700 Subject: [PATCH 2/7] Hide title --- resources/js/components/publish/Field.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/js/components/publish/Field.vue b/resources/js/components/publish/Field.vue index 5a30fd8bb80..313c5ae0c09 100644 --- a/resources/js/components/publish/Field.vue +++ b/resources/js/components/publish/Field.vue @@ -12,6 +12,7 @@ :class="{ 'text-grey-60': syncable && isSynced }" v-text="labelText" v-tooltip="{content: config.handle, delay: 500, autoHide: false}" + v-if="!config.hide_display" /> * From f43e69fa5800f2ccc32e17117f849a761609e54d Mon Sep 17 00:00:00 2001 From: edalzell Date: Sun, 14 Aug 2022 20:10:03 -0700 Subject: [PATCH 3/7] =?UTF-8?q?it=E2=80=99s=20=E2=80=98Hide=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/lang/en/messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 3da9257be6c..d39ecdf4d8e 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -65,7 +65,7 @@ 'field_validation_required_instructions' => 'Control whether or not this field is required.', 'fields_blueprints_description' => 'Blueprints define the fields for content structures like collections, taxonomies, users, and forms.', 'fields_default_instructions' => 'Set the default value.', - 'fields_hide_display_instructions' => 'Show the display field in the Control Panel?', + 'fields_hide_display_instructions' => 'Hide the display field in the Control Panel?', 'fields_display_instructions' => 'The field\'s label shown in the Control Panel.', 'fields_fieldsets_description' => 'Fieldsets are simple, flexible, and completely optional groupings of fields that help to organize reusable, pre-configured fields.', 'fields_handle_instructions' => 'The field\'s template variable.', From 143c390258d1b54a99805ac9863b186be0609955 Mon Sep 17 00:00:00 2001 From: edalzell Date: Tue, 16 Aug 2022 15:14:22 -0700 Subject: [PATCH 4/7] Revert "config to hide the display" This reverts commit f8e9043f344df56255b40a27799e269131a20860. # Conflicts: # resources/lang/en/messages.php --- resources/lang/en/messages.php | 1 - src/Http/Controllers/CP/Fields/FieldsController.php | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index d39ecdf4d8e..8e27a31697d 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -65,7 +65,6 @@ 'field_validation_required_instructions' => 'Control whether or not this field is required.', 'fields_blueprints_description' => 'Blueprints define the fields for content structures like collections, taxonomies, users, and forms.', 'fields_default_instructions' => 'Set the default value.', - 'fields_hide_display_instructions' => 'Hide the display field in the Control Panel?', 'fields_display_instructions' => 'The field\'s label shown in the Control Panel.', 'fields_fieldsets_description' => 'Fieldsets are simple, flexible, and completely optional groupings of fields that help to organize reusable, pre-configured fields.', 'fields_handle_instructions' => 'The field\'s template variable.', diff --git a/src/Http/Controllers/CP/Fields/FieldsController.php b/src/Http/Controllers/CP/Fields/FieldsController.php index d8567a2939d..46a08ee4995 100644 --- a/src/Http/Controllers/CP/Fields/FieldsController.php +++ b/src/Http/Controllers/CP/Fields/FieldsController.php @@ -86,22 +86,15 @@ protected function blueprint($blueprint) 'display' => __('Display'), 'instructions' => __('statamic::messages.fields_display_instructions'), 'type' => 'text', - 'width' => 33, + 'width' => 50, 'autoselect' => true, ], - 'hide_display' => [ - 'display' => __('Hide Display'), - 'instructions' => __('statamic::messages.fields_hide_display_instructions'), - 'type' => 'toggle', - 'width' => 33, - 'default' => false, - ], 'handle' => [ 'display' => __('Handle'), 'instructions' => __('statamic::messages.fields_handle_instructions'), 'type' => 'text', 'validate' => 'required|not_in:'.implode(',', $reserved), - 'width' => 33, + 'width' => 50, ], 'instructions' => [ 'display' => __('Instructions'), From b7ec278d866f61e7060a5c40ea62cee40c28da93 Mon Sep 17 00:00:00 2001 From: edalzell Date: Tue, 16 Aug 2022 15:14:36 -0700 Subject: [PATCH 5/7] =?UTF-8?q?Revert=20"it=E2=80=99s=20=E2=80=98Hide?= =?UTF-8?q?=E2=80=99"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit f43e69fa5800f2ccc32e17117f849a761609e54d. # Conflicts: # resources/lang/en/messages.php --- resources/js/components/publish/Field.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/js/components/publish/Field.vue b/resources/js/components/publish/Field.vue index 313c5ae0c09..5a30fd8bb80 100644 --- a/resources/js/components/publish/Field.vue +++ b/resources/js/components/publish/Field.vue @@ -12,7 +12,6 @@ :class="{ 'text-grey-60': syncable && isSynced }" v-text="labelText" v-tooltip="{content: config.handle, delay: 500, autoHide: false}" - v-if="!config.hide_display" /> * From 8a3cd2f5fb51eba37f3a3d592ea0584192e38c90 Mon Sep 17 00:00:00 2001 From: edalzell Date: Tue, 16 Aug 2022 20:12:21 -0700 Subject: [PATCH 6/7] =?UTF-8?q?don=E2=80=99t=20use=20default=20on=20publis?= =?UTF-8?q?h=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Fields/Field.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Fields/Field.php b/src/Fields/Field.php index a566be5c140..b464d663bde 100644 --- a/src/Fields/Field.php +++ b/src/Fields/Field.php @@ -78,9 +78,12 @@ public function fieldtype() return FieldtypeRepository::find($this->type())->setField($this); } - public function display() + public function display($useDefault = true) { - return array_get($this->config, 'display', __(Str::slugToTitle($this->handle))); + return array_get( + $this->config, + 'display', + $useDefault ? __(Str::slugToTitle($this->handle)) : null); } public function instructions() @@ -226,7 +229,7 @@ public function toPublishArray() 'handle' => $this->handle, 'prefix' => $this->prefix, 'type' => $this->type(), - 'display' => $this->display(), + 'display' => $this->display(false), 'instructions' => $this->instructions(), 'required' => $this->isRequired(), 'visibility' => $this->visibility(), From c34978c77245de3787ce90b538b6838ab78e1515 Mon Sep 17 00:00:00 2001 From: edalzell Date: Wed, 17 Aug 2022 18:18:31 -0700 Subject: [PATCH 7/7] =?UTF-8?q?Revert=20"don=E2=80=99t=20use=20default=20o?= =?UTF-8?q?n=20publish=20array"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8a3cd2f5fb51eba37f3a3d592ea0584192e38c90. --- src/Fields/Field.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Fields/Field.php b/src/Fields/Field.php index b464d663bde..a566be5c140 100644 --- a/src/Fields/Field.php +++ b/src/Fields/Field.php @@ -78,12 +78,9 @@ public function fieldtype() return FieldtypeRepository::find($this->type())->setField($this); } - public function display($useDefault = true) + public function display() { - return array_get( - $this->config, - 'display', - $useDefault ? __(Str::slugToTitle($this->handle)) : null); + return array_get($this->config, 'display', __(Str::slugToTitle($this->handle))); } public function instructions() @@ -229,7 +226,7 @@ public function toPublishArray() 'handle' => $this->handle, 'prefix' => $this->prefix, 'type' => $this->type(), - 'display' => $this->display(false), + 'display' => $this->display(), 'instructions' => $this->instructions(), 'required' => $this->isRequired(), 'visibility' => $this->visibility(),