Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-9249: Description override field for tpr units #653

Merged
merged 9 commits into from
Dec 21, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ content:
third_party_settings: { }
address:
type: readonly_field_widget
weight: 19
weight: 20
region: content
settings:
label: above
Expand Down Expand Up @@ -110,6 +110,17 @@ content:
formatter_settings: { }
show_description: false
third_party_settings: { }
enrich_description:
type: text_textarea
weight: 19
region: content
settings:
rows: 5
placeholder: ''
third_party_settings:
allowed_formats:
hide_help: '1'
hide_guidelines: '1'
field_content:
type: paragraphs
weight: 28
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ content:
third_party_settings: { }
weight: 8
region: content
enrich_description:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 3
region: content
field_content:
type: entity_reference_revisions_entity_view
label: hidden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ hidden:
created: true
description: true
email: true
enrich_description: true
field_content: true
field_lower_content: true
field_metatags: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ hidden:
created: true
description: true
email: true
enrich_description: true
field_content: true
field_lower_content: true
field_metatags: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ hidden:
created: true
description: true
email: true
enrich_description: true
field_content: true
field_lower_content: true
field_metatags: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ hidden:
created: true
description: true
email: true
enrich_description: true
field_content: true
field_lower_content: true
field_metatags: true
Expand Down
21 changes: 21 additions & 0 deletions modules/helfi_tpr_config/helfi_tpr_config.install
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,24 @@ function helfi_tpr_config_update_9050(): void {
function helfi_tpr_config_update_9051(): void {
helfi_platform_config_update_paragraph_target_types();
}

/**
* UHF-9249: Add an long description field for filling missing data.
*/
function helfi_tpr_config_update_9052() : void {
$enrich_description = BaseFieldDefinition::create('text_with_summary')
->setTranslatable(TRUE)
->setRevisionable(FALSE)
->setLabel(new TranslatableMarkup('Long description (replacing missing information'))
->setDescription(new TranslatableMarkup('Note! The content is displayed on the website only if the long description is missing from the data source.'))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setSetting('allowed_formats', [0 => 'plain_text']);

\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('enrich_description', 'tpr_unit', 'helfi_tpr_config', $enrich_description);

// Re-import 'helfi_tpr_config' configuration.
\Drupal::service('helfi_platform_config.config_update_helper')
->update('helfi_tpr_config');
}
12 changes: 11 additions & 1 deletion modules/helfi_tpr_config/helfi_tpr_config.module
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,17 @@ function helfi_tpr_config_entity_base_field_info(EntityTypeInterface $entity_typ
'weight' => 5,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
->setDisplayConfigurable('view', TRUE)
->setSetting('allowed_formats', [0 => 'plain_text']);

$fields['enrich_description'] = BaseFieldDefinition::create('text_with_summary')
->setTranslatable(TRUE)
->setRevisionable(FALSE)
->setLabel(new TranslatableMarkup('Long description (replacing missing information)'))
->setDescription(new TranslatableMarkup('Note! The content is displayed on the website only if the long description is missing from the data source.'))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setSetting('allowed_formats', [0 => 'plain_text']);
}
return $fields;
}
6 changes: 6 additions & 0 deletions modules/helfi_tpr_config/translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ msgstr "Piilota palvelupaikkojen listaus"

msgid "Select this if you link from the page to a filter search or another listing."
msgstr "Valitse tämä, jos linkität sivulta palvelupaikkojen suodatushakuun tai muuhun listaukseen."

msgid "Long description (replacing missing information)"
msgstr "Pitkä kuvaus (vain puuttuvalle tiedolle)"

msgid "Note! The content is displayed on the website only if the long description is missing from the data source."
msgstr "Huom! Kentän sisältö näytetään verkkosivulla vain, jos pitkä kuvaus puuttuu kokonaan lähdejärjestelmästä."
6 changes: 6 additions & 0 deletions modules/helfi_tpr_config/translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ msgstr "Dölj listan om serviceställen"

msgid "Select this if you link from the page to a filter search or another listing."
msgstr "Välj detta om du länkar från sidan till en filtersökning eller till en separat lista."

msgid "Long description (replacing missing information)"
msgstr "Lång beskrivning (ersätter saknad information)"

msgid "Note! The content is displayed on the website only if the long description is missing from the data source."
msgstr "Observera! Innehållet visas på webbplatsen endast om den långa beskrivningen saknas från datakäll."
Loading