diff --git a/modules/hdbt_admin_tools/hdbt_admin_tools.module b/modules/hdbt_admin_tools/hdbt_admin_tools.module index 216ae33b2..1a6cae69d 100644 --- a/modules/hdbt_admin_tools/hdbt_admin_tools.module +++ b/modules/hdbt_admin_tools/hdbt_admin_tools.module @@ -147,6 +147,24 @@ function hdbt_admin_tools_form_node_form_alter(&$form, &$form_state, $form_id): $form['actions']['submit']['#submit'][] = 'hdbt_admin_tools_node_form_submit_callback'; } +/** + * Implements hook_form_FORM_ID_alter(). + */ +function hdbt_admin_tools_form_tpr_unit_form_alter(&$form, &$form_state, $form_id): void { + $form['field_phone_label']['#states'] = [ + 'visible' => [ + ':input[name="field_phone_with_contacts[value]"]' => ['checked' => TRUE], + ], + ]; + + // Required state must the widget rather than the form element. + $form['field_phone_label']['widget'][0]['value']['#states'] = [ + 'required' => [ + ':input[name="field_phone_with_contacts[value]"]' => ['checked' => TRUE], + ], + ]; +} + /** * Form submit callback for node forms. * diff --git a/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml b/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml index 358cf7d67..96f4da56a 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_form_display.tpr_unit.tpr_unit.default.yml @@ -5,8 +5,11 @@ dependencies: - field.field.tpr_unit.tpr_unit.field_content - field.field.tpr_unit.tpr_unit.field_lower_content - field.field.tpr_unit.tpr_unit.field_metatags + - field.field.tpr_unit.tpr_unit.field_phone_label + - field.field.tpr_unit.tpr_unit.field_phone_with_contacts - field.field.tpr_unit.tpr_unit.field_unit_type module: + - allowed_formats - hdbt_admin_tools - helfi_tpr - media_library @@ -15,6 +18,7 @@ dependencies: - path - readonly_field_widget - select2 + - text id: tpr_unit.tpr_unit.default targetEntityType: tpr_unit bundle: tpr_unit @@ -22,7 +26,7 @@ mode: default content: accessibility_email: type: readonly_field_widget - weight: 12 + weight: 14 region: content settings: label: above @@ -32,7 +36,7 @@ content: third_party_settings: { } accessibility_phone: type: readonly_field_widget - weight: 11 + weight: 13 region: content settings: label: above @@ -42,7 +46,7 @@ content: third_party_settings: { } accessibility_www: type: readonly_field_widget - weight: 17 + weight: 19 region: content settings: label: above @@ -52,7 +56,7 @@ content: third_party_settings: { } address: type: readonly_field_widget - weight: 20 + weight: 22 region: content settings: label: above @@ -62,7 +66,7 @@ content: third_party_settings: { } address_postal: type: readonly_field_widget - weight: 21 + weight: 24 region: content settings: label: above @@ -72,7 +76,7 @@ content: third_party_settings: { } call_charge_info: type: readonly_field_widget - weight: 20 + weight: 23 region: content settings: label: above @@ -82,7 +86,7 @@ content: third_party_settings: { } contacts: type: readonly_field_widget - weight: 39 + weight: 43 region: content settings: label: above @@ -92,7 +96,7 @@ content: third_party_settings: { } description: type: readonly_field_widget - weight: 18 + weight: 20 region: content settings: label: above @@ -102,7 +106,7 @@ content: third_party_settings: { } email: type: readonly_field_widget - weight: 10 + weight: 12 region: content settings: label: above @@ -112,7 +116,7 @@ content: third_party_settings: { } enrich_description: type: text_textarea - weight: 19 + weight: 21 region: content settings: rows: 5 @@ -123,7 +127,7 @@ content: hide_guidelines: '1' field_content: type: paragraphs - weight: 28 + weight: 31 region: content settings: title: Paragraph @@ -142,7 +146,7 @@ content: third_party_settings: { } field_lower_content: type: paragraphs - weight: 29 + weight: 33 region: content settings: title: Paragraph @@ -161,15 +165,30 @@ content: third_party_settings: { } field_metatags: type: metatag_firehose - weight: 27 + weight: 30 region: content settings: sidebar: false use_details: true third_party_settings: { } + field_phone_label: + type: string_textfield + weight: 11 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + field_phone_with_contacts: + type: boolean_checkbox + weight: 10 + region: content + settings: + display_label: true + third_party_settings: { } field_unit_type: type: entity_reference_autocomplete - weight: 30 + weight: 34 region: content settings: match_operator: CONTAINS @@ -179,14 +198,14 @@ content: third_party_settings: { } hide_sidebar_navigation: type: boolean_checkbox - weight: 31 + weight: 35 region: content settings: display_label: true third_party_settings: { } highlights: type: readonly_field_widget - weight: 36 + weight: 40 region: content settings: label: above @@ -203,7 +222,7 @@ content: third_party_settings: { } latitude: type: readonly_field_widget - weight: 22 + weight: 25 region: content settings: label: above @@ -213,7 +232,7 @@ content: third_party_settings: { } links: type: readonly_field_widget - weight: 33 + weight: 37 region: content settings: label: above @@ -223,7 +242,7 @@ content: third_party_settings: { } longitude: type: readonly_field_widget - weight: 23 + weight: 26 region: content settings: label: above @@ -251,7 +270,7 @@ content: third_party_settings: { } opening_hours: type: readonly_field_widget - weight: 35 + weight: 39 region: content settings: label: above @@ -261,7 +280,7 @@ content: third_party_settings: { } other_info: type: readonly_field_widget - weight: 37 + weight: 41 region: content settings: label: above @@ -271,7 +290,7 @@ content: third_party_settings: { } path: type: path - weight: 16 + weight: 18 region: content settings: { } third_party_settings: { } @@ -304,7 +323,7 @@ content: third_party_settings: { } price_info: type: readonly_field_widget - weight: 38 + weight: 42 region: content settings: label: above @@ -314,7 +333,7 @@ content: third_party_settings: { } provided_languages: type: readonly_field_widget - weight: 32 + weight: 36 region: content settings: label: above @@ -324,7 +343,7 @@ content: third_party_settings: { } service_map_embed: type: readonly_field_widget - weight: 25 + weight: 28 region: content settings: label: above @@ -334,7 +353,7 @@ content: third_party_settings: { } services: type: readonly_field_widget - weight: 26 + weight: 29 region: content settings: label: above @@ -344,19 +363,19 @@ content: third_party_settings: { } show_www: type: boolean_checkbox - weight: 15 + weight: 17 region: content settings: display_label: true third_party_settings: { } simple_sitemap: - weight: 14 + weight: 16 region: content settings: { } third_party_settings: { } streetview_entrance_url: type: readonly_field_widget - weight: 24 + weight: 27 region: content settings: label: above @@ -381,7 +400,7 @@ content: third_party_settings: { } topical: type: readonly_field_widget - weight: 34 + weight: 38 region: content settings: label: above @@ -404,7 +423,7 @@ content: third_party_settings: { } www: type: readonly_field_widget - weight: 13 + weight: 15 region: content settings: label: above diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml index 8958b6fdb..570e1d5ef 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.default.yml @@ -5,6 +5,8 @@ dependencies: - field.field.tpr_unit.tpr_unit.field_content - field.field.tpr_unit.tpr_unit.field_lower_content - field.field.tpr_unit.tpr_unit.field_metatags + - field.field.tpr_unit.tpr_unit.field_phone_label + - field.field.tpr_unit.tpr_unit.field_phone_with_contacts - field.field.tpr_unit.tpr_unit.field_unit_type - responsive_image.styles.image__3_2 module: @@ -131,6 +133,24 @@ content: third_party_settings: { } weight: 17 region: content + field_phone_label: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 31 + region: content + field_phone_with_contacts: + type: boolean + label: above + settings: + format: default + format_custom_false: '' + format_custom_true: '' + third_party_settings: { } + weight: 33 + region: content highlights: type: tpr_connection label: hidden diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml index a96442340..3bc466642 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.minimal.yml @@ -6,6 +6,8 @@ dependencies: - field.field.tpr_unit.tpr_unit.field_content - field.field.tpr_unit.tpr_unit.field_lower_content - field.field.tpr_unit.tpr_unit.field_metatags + - field.field.tpr_unit.tpr_unit.field_phone_label + - field.field.tpr_unit.tpr_unit.field_phone_with_contacts - field.field.tpr_unit.tpr_unit.field_unit_type module: - address @@ -45,6 +47,7 @@ hidden: accessibility_www: true address_postal: true call_charge_info: true + contacts: true created: true description: true email: true @@ -52,16 +55,21 @@ hidden: field_content: true field_lower_content: true field_metatags: true + field_phone_label: true + field_phone_with_contacts: true field_unit_type: true hide_description: true highlights: true langcode: true latitude: true + links: true longitude: true opening_hours: true + other_info: true phone: true picture_url: true picture_url_override: true + price_info: true provided_languages: true service_map_embed: true services: true @@ -69,5 +77,6 @@ hidden: streetview_entrance_url: true subgroup: true toc_enabled: true + topical: true unit_picture_caption: true www: true diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml index 288b4deb8..5dc83b261 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser.yml @@ -6,6 +6,8 @@ dependencies: - field.field.tpr_unit.tpr_unit.field_content - field.field.tpr_unit.tpr_unit.field_lower_content - field.field.tpr_unit.tpr_unit.field_metatags + - field.field.tpr_unit.tpr_unit.field_phone_label + - field.field.tpr_unit.tpr_unit.field_phone_with_contacts - field.field.tpr_unit.tpr_unit.field_unit_type - responsive_image.styles.image__3_2 module: @@ -65,6 +67,7 @@ hidden: accessibility_www: true address_postal: true call_charge_info: true + contacts: true created: true description: true email: true @@ -72,14 +75,19 @@ hidden: field_content: true field_lower_content: true field_metatags: true + field_phone_label: true + field_phone_with_contacts: true field_unit_type: true hide_description: true highlights: true langcode: true latitude: true + links: true longitude: true opening_hours: true + other_info: true phone: true + price_info: true provided_languages: true service_map_embed: true services: true @@ -87,5 +95,6 @@ hidden: streetview_entrance_url: true subgroup: true toc_enabled: true + topical: true unit_picture_caption: true www: true diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser_with_image.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser_with_image.yml index f4504044b..7acdef28d 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser_with_image.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.teaser_with_image.yml @@ -6,6 +6,8 @@ dependencies: - field.field.tpr_unit.tpr_unit.field_content - field.field.tpr_unit.tpr_unit.field_lower_content - field.field.tpr_unit.tpr_unit.field_metatags + - field.field.tpr_unit.tpr_unit.field_phone_label + - field.field.tpr_unit.tpr_unit.field_phone_with_contacts - field.field.tpr_unit.tpr_unit.field_unit_type - responsive_image.styles.image__3_2 module: @@ -66,6 +68,7 @@ hidden: accessibility_www: true address_postal: true call_charge_info: true + contacts: true created: true description: true email: true @@ -73,14 +76,19 @@ hidden: field_content: true field_lower_content: true field_metatags: true + field_phone_label: true + field_phone_with_contacts: true field_unit_type: true hide_description: true highlights: true langcode: true latitude: true + links: true longitude: true name_override: true opening_hours: true + other_info: true + price_info: true provided_languages: true service_map_embed: true services: true @@ -88,4 +96,6 @@ hidden: streetview_entrance_url: true subgroup: true toc_enabled: true + topical: true + unit_picture_caption: true www: true diff --git a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.wide_teaser.yml b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.wide_teaser.yml index 110449244..9999968cc 100644 --- a/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.wide_teaser.yml +++ b/modules/helfi_tpr_config/config/install/core.entity_view_display.tpr_unit.tpr_unit.wide_teaser.yml @@ -6,6 +6,8 @@ dependencies: - field.field.tpr_unit.tpr_unit.field_content - field.field.tpr_unit.tpr_unit.field_lower_content - field.field.tpr_unit.tpr_unit.field_metatags + - field.field.tpr_unit.tpr_unit.field_phone_label + - field.field.tpr_unit.tpr_unit.field_phone_with_contacts - field.field.tpr_unit.tpr_unit.field_unit_type - responsive_image.styles.image__3_2 module: @@ -81,6 +83,7 @@ hidden: accessibility_www: true address_postal: true call_charge_info: true + contacts: true created: true description: true email: true @@ -88,12 +91,17 @@ hidden: field_content: true field_lower_content: true field_metatags: true + field_phone_label: true + field_phone_with_contacts: true field_unit_type: true hide_description: true highlights: true langcode: true latitude: true + links: true longitude: true + other_info: true + price_info: true provided_languages: true service_map_embed: true services: true @@ -101,4 +109,6 @@ hidden: streetview_entrance_url: true subgroup: true toc_enabled: true + topical: true + unit_picture_caption: true www: true diff --git a/modules/helfi_tpr_config/config/install/field.field.tpr_unit.tpr_unit.field_phone_label.yml b/modules/helfi_tpr_config/config/install/field.field.tpr_unit.tpr_unit.field_phone_label.yml new file mode 100644 index 000000000..61d88f11b --- /dev/null +++ b/modules/helfi_tpr_config/config/install/field.field.tpr_unit.tpr_unit.field_phone_label.yml @@ -0,0 +1,19 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.tpr_unit.field_phone_label + module: + - helfi_tpr +id: tpr_unit.tpr_unit.field_phone_label +field_name: field_phone_label +entity_type: tpr_unit +bundle: tpr_unit +label: 'Phone label' +description: 'The label shown above the phone number when displayed in other contact info accordion.' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/modules/helfi_tpr_config/config/install/field.field.tpr_unit.tpr_unit.field_phone_with_contacts.yml b/modules/helfi_tpr_config/config/install/field.field.tpr_unit.tpr_unit.field_phone_with_contacts.yml new file mode 100644 index 000000000..22b07e865 --- /dev/null +++ b/modules/helfi_tpr_config/config/install/field.field.tpr_unit.tpr_unit.field_phone_with_contacts.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.tpr_unit.field_phone_with_contacts + module: + - helfi_tpr +id: tpr_unit.tpr_unit.field_phone_with_contacts +field_name: field_phone_with_contacts +entity_type: tpr_unit +bundle: tpr_unit +label: 'Move phone to Other contact information accordion' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + on_label: 'On' + off_label: 'Off' +field_type: boolean diff --git a/modules/helfi_tpr_config/config/install/field.storage.tpr_unit.field_phone_label.yml b/modules/helfi_tpr_config/config/install/field.storage.tpr_unit.field_phone_label.yml new file mode 100644 index 000000000..63a1cc387 --- /dev/null +++ b/modules/helfi_tpr_config/config/install/field.storage.tpr_unit.field_phone_label.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - helfi_tpr +id: tpr_unit.field_phone_label +field_name: field_phone_label +entity_type: tpr_unit +type: string +settings: + max_length: 255 + case_sensitive: false + is_ascii: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/helfi_tpr_config/config/install/field.storage.tpr_unit.field_phone_with_contacts.yml b/modules/helfi_tpr_config/config/install/field.storage.tpr_unit.field_phone_with_contacts.yml new file mode 100644 index 000000000..39c1d5eee --- /dev/null +++ b/modules/helfi_tpr_config/config/install/field.storage.tpr_unit.field_phone_with_contacts.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + module: + - helfi_tpr +id: tpr_unit.field_phone_with_contacts +field_name: field_phone_with_contacts +entity_type: tpr_unit +type: boolean +settings: { } +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/helfi_tpr_config/config/optional/language/fi/field.field.tpr_unit.tpr_unit.field_phone_label.yml b/modules/helfi_tpr_config/config/optional/language/fi/field.field.tpr_unit.tpr_unit.field_phone_label.yml new file mode 100644 index 000000000..89542105d --- /dev/null +++ b/modules/helfi_tpr_config/config/optional/language/fi/field.field.tpr_unit.tpr_unit.field_phone_label.yml @@ -0,0 +1,2 @@ +label: 'Yhteystiedon nimi' +description: 'Kirjoita puhelinnumeron ylläpuolella näytettävä nimi.' diff --git a/modules/helfi_tpr_config/config/optional/language/fi/field.field.tpr_unit.tpr_unit.field_phone_with_contacts.yml b/modules/helfi_tpr_config/config/optional/language/fi/field.field.tpr_unit.tpr_unit.field_phone_with_contacts.yml new file mode 100644 index 000000000..f75ce8d24 --- /dev/null +++ b/modules/helfi_tpr_config/config/optional/language/fi/field.field.tpr_unit.tpr_unit.field_phone_with_contacts.yml @@ -0,0 +1 @@ +label: 'Siirrä puhelinnumero Muut yhteystiedot -haitariin' diff --git a/modules/helfi_tpr_config/helfi_tpr_config.install b/modules/helfi_tpr_config/helfi_tpr_config.install index 37be238dc..ed7ba65e7 100644 --- a/modules/helfi_tpr_config/helfi_tpr_config.install +++ b/modules/helfi_tpr_config/helfi_tpr_config.install @@ -397,3 +397,12 @@ function helfi_tpr_config_update_9062(): void { \Drupal::service('helfi_platform_config.config_update_helper') ->update('helfi_tpr_config'); } + +/** + * UHF-9496: Move phone number option. + */ +function helfi_tpr_config_update_9063(): void { + // Re-import 'helfi_tpr_config' configuration. + \Drupal::service('helfi_platform_config.config_update_helper') + ->update('helfi_tpr_config'); +}