From 1aa9d62d62bd84186aff9c67367fb6d5ea50e048 Mon Sep 17 00:00:00 2001 From: shuklina Date: Mon, 24 Jan 2022 16:47:17 +0200 Subject: [PATCH 1/3] Hide direction if the address is empty --- ...eld.node.branch.field_location_address.yml | 52 +++++++++++++++++++ ....node.branch.field_location_directions.yml | 29 +++++++++++ .../openy_loc_branch/openy_loc_branch.install | 13 +++++ 3 files changed, 94 insertions(+) create mode 100644 openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml create mode 100644 openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml diff --git a/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml b/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml new file mode 100644 index 00000000..39f183e7 --- /dev/null +++ b/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml @@ -0,0 +1,52 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_location_address + - node.type.branch + module: + - address + - datalayer +third_party_settings: + datalayer: + expose: 1 + label: field_location_address +id: node.branch.field_location_address +field_name: field_location_address +entity_type: node +bundle: branch +label: Address +description: 'Put address here or keep it empty to disable address and Directions url' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + available_countries: + US: US + langcode_override: '' + field_overrides: + givenName: + override: hidden + additionalName: + override: hidden + familyName: + override: hidden + organization: + override: hidden + addressLine1: + override: optional + addressLine2: + override: hidden + postalCode: + override: optional + sortingCode: + override: hidden + dependentLocality: + override: hidden + locality: + override: optional + administrativeArea: + override: optional + fields: { } +field_type: address diff --git a/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml b/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml new file mode 100644 index 00000000..125e2d55 --- /dev/null +++ b/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml @@ -0,0 +1,29 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_location_directions + - node.type.branch + module: + - datalayer + - link +third_party_settings: + datalayer: + expose: 1 + label: field_location_directions +_core: + default_config_hash: wECsSrrpKwpR9l0_0o0esc5NK7Rf-JTr46G-JOhFzEU +id: node.branch.field_location_directions +field_name: field_location_directions +entity_type: node +bundle: branch +label: Directions +description: 'To remove the "Get Directions" link from the location page, just leave URL and Link text fields blank.' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + title: 1 + link_type: 17 +field_type: link diff --git a/openy_location/modules/openy_loc_branch/openy_loc_branch.install b/openy_location/modules/openy_loc_branch/openy_loc_branch.install index 5bac545c..6c4cc069 100644 --- a/openy_location/modules/openy_loc_branch/openy_loc_branch.install +++ b/openy_location/modules/openy_loc_branch/openy_loc_branch.install @@ -473,3 +473,16 @@ function openy_loc_branch_update_8023() { } } } + +/** + * Address Field not "Required". + */ +function openy_loc_branch_update_8024() { + $path = \Drupal::service('extension.list.module')->getPath('openy_loc_branch') . '/config/optional'; + $config_importer = \Drupal::service('config_import.importer'); + $config_importer->setDirectory($path); + $config_importer->importConfigs([ + 'field.field.node.branch.field_location_address', + 'field.field.node.branch.field_location_directions', + ]); +} From 9328a590b13cb9f0432284d8aaa51b1c13e6b07f Mon Sep 17 00:00:00 2001 From: shuklina Date: Tue, 25 Jan 2022 08:56:15 +0200 Subject: [PATCH 2/3] Move config to install folder --- ...eld.node.branch.field_location_address.yml | 41 +++++++++------ ....node.branch.field_location_directions.yml | 6 ++- ...eld.node.branch.field_location_address.yml | 52 ------------------- ....node.branch.field_location_directions.yml | 29 ----------- .../openy_loc_branch/openy_loc_branch.install | 2 +- 5 files changed, 31 insertions(+), 99 deletions(-) delete mode 100644 openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml delete mode 100644 openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml diff --git a/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_address.yml b/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_address.yml index 3ba1b076..39f183e7 100644 --- a/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_address.yml +++ b/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_address.yml @@ -16,26 +16,37 @@ field_name: field_location_address entity_type: node bundle: branch label: Address -description: '' -required: true +description: 'Put address here or keep it empty to disable address and Directions url' +required: false translatable: true default_value: { } default_value_callback: '' settings: available_countries: US: US - fields: - administrativeArea: administrativeArea - locality: locality - postalCode: postalCode - addressLine1: addressLine1 - dependentLocality: '0' - sortingCode: '0' - addressLine2: '0' - organization: '0' - givenName: '0' - additionalName: '0' - familyName: '0' langcode_override: '' - field_overrides: { } + field_overrides: + givenName: + override: hidden + additionalName: + override: hidden + familyName: + override: hidden + organization: + override: hidden + addressLine1: + override: optional + addressLine2: + override: hidden + postalCode: + override: optional + sortingCode: + override: hidden + dependentLocality: + override: hidden + locality: + override: optional + administrativeArea: + override: optional + fields: { } field_type: address diff --git a/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml b/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml index 5b572be1..125e2d55 100644 --- a/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml +++ b/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml @@ -11,17 +11,19 @@ third_party_settings: datalayer: expose: 1 label: field_location_directions +_core: + default_config_hash: wECsSrrpKwpR9l0_0o0esc5NK7Rf-JTr46G-JOhFzEU id: node.branch.field_location_directions field_name: field_location_directions entity_type: node bundle: branch label: Directions -description: '' +description: 'To remove the "Get Directions" link from the location page, just leave URL and Link text fields blank.' required: false translatable: true default_value: { } default_value_callback: '' settings: - link_type: 17 title: 1 + link_type: 17 field_type: link diff --git a/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml b/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml deleted file mode 100644 index 39f183e7..00000000 --- a/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_address.yml +++ /dev/null @@ -1,52 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_location_address - - node.type.branch - module: - - address - - datalayer -third_party_settings: - datalayer: - expose: 1 - label: field_location_address -id: node.branch.field_location_address -field_name: field_location_address -entity_type: node -bundle: branch -label: Address -description: 'Put address here or keep it empty to disable address and Directions url' -required: false -translatable: true -default_value: { } -default_value_callback: '' -settings: - available_countries: - US: US - langcode_override: '' - field_overrides: - givenName: - override: hidden - additionalName: - override: hidden - familyName: - override: hidden - organization: - override: hidden - addressLine1: - override: optional - addressLine2: - override: hidden - postalCode: - override: optional - sortingCode: - override: hidden - dependentLocality: - override: hidden - locality: - override: optional - administrativeArea: - override: optional - fields: { } -field_type: address diff --git a/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml b/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml deleted file mode 100644 index 125e2d55..00000000 --- a/openy_location/modules/openy_loc_branch/config/optional/field.field.node.branch.field_location_directions.yml +++ /dev/null @@ -1,29 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_location_directions - - node.type.branch - module: - - datalayer - - link -third_party_settings: - datalayer: - expose: 1 - label: field_location_directions -_core: - default_config_hash: wECsSrrpKwpR9l0_0o0esc5NK7Rf-JTr46G-JOhFzEU -id: node.branch.field_location_directions -field_name: field_location_directions -entity_type: node -bundle: branch -label: Directions -description: 'To remove the "Get Directions" link from the location page, just leave URL and Link text fields blank.' -required: false -translatable: true -default_value: { } -default_value_callback: '' -settings: - title: 1 - link_type: 17 -field_type: link diff --git a/openy_location/modules/openy_loc_branch/openy_loc_branch.install b/openy_location/modules/openy_loc_branch/openy_loc_branch.install index 6c4cc069..91417cb1 100644 --- a/openy_location/modules/openy_loc_branch/openy_loc_branch.install +++ b/openy_location/modules/openy_loc_branch/openy_loc_branch.install @@ -478,7 +478,7 @@ function openy_loc_branch_update_8023() { * Address Field not "Required". */ function openy_loc_branch_update_8024() { - $path = \Drupal::service('extension.list.module')->getPath('openy_loc_branch') . '/config/optional'; + $path = \Drupal::service('extension.list.module')->getPath('openy_loc_branch') . '/config/install'; $config_importer = \Drupal::service('config_import.importer'); $config_importer->setDirectory($path); $config_importer->importConfigs([ From 641b263d961349a2b1c38f1ce2fb66a793a26cda Mon Sep 17 00:00:00 2001 From: shuklina Date: Tue, 25 Jan 2022 13:57:35 +0200 Subject: [PATCH 3/3] Small fix --- .../field.field.node.branch.field_location_directions.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml b/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml index 125e2d55..743aa879 100644 --- a/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml +++ b/openy_location/modules/openy_loc_branch/config/install/field.field.node.branch.field_location_directions.yml @@ -11,8 +11,6 @@ third_party_settings: datalayer: expose: 1 label: field_location_directions -_core: - default_config_hash: wECsSrrpKwpR9l0_0o0esc5NK7Rf-JTr46G-JOhFzEU id: node.branch.field_location_directions field_name: field_location_directions entity_type: node