Skip to content

Commit

Permalink
Merge pull request #606 from City-of-Helsinki/UHF-8938
Browse files Browse the repository at this point in the history
UHF-8938: Caption field for TPR-units
  • Loading branch information
teroelonen authored Oct 5, 2023
2 parents 64c91e2 + cf9f743 commit 9365281
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 27 deletions.
1 change: 0 additions & 1 deletion modules/helfi_base_content/helfi_base_content.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ dependencies:
- drupal:taxonomy
- drupal:text
- easy_breadcrumb:easy_breadcrumb
- editoria11y:editoria11y
- entity_reference_revisions:entity_reference_revisions
- hdbt_admin_tools:hdbt_admin_tools
- helfi_platform_config:helfi_platform_config
Expand Down
6 changes: 0 additions & 6 deletions modules/helfi_base_content/helfi_base_content.install
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ function helfi_base_content_grant_permissions() : void {
'translate configuration',
// @content_lock.
'break content lock',
// @editorially.
'view editoria11y checker',
// @locale.
'translate interface',
// @menu_link_attributes.
Expand Down Expand Up @@ -95,8 +93,6 @@ function helfi_base_content_grant_permissions() : void {
'content_producer' => [
// @content_translation.
'translate editable entities',
// @editorially.
'view editoria11y checker',
// @helfi_api_base.
'access remote entities overview',
// @menu_link_content.
Expand Down Expand Up @@ -132,8 +128,6 @@ function helfi_base_content_grant_permissions() : void {
'translate any entity',
'translate editable entities',
'update content translations',
// @editorially.
'view editoria11y checker',
// @node.
'access content overview',
'administer nodes',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ core_version_requirement: '^9 || ^10'
dependencies:
- drupal:block
- eu_cookie_compliance:eu_cookie_compliance
- helfi_base_content:helfi_base_content
- helfi_platform_config:helfi_platform_config
- helfi_user_roles:helfi_user_roles
package: HELfi
'interface translation project': helfi_eu_cookie_compliance
'interface translation server pattern': modules/contrib/helfi_platform_config/modules/helfi_eu_cookie_compliance/translations/%language.po
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class EuCookieComplianceTest extends BrowserTestBase {
protected static $modules = [
'block',
'helfi_api_base',
'helfi_user_roles',
'helfi_eu_cookie_compliance',
];

Expand Down
2 changes: 1 addition & 1 deletion modules/helfi_media_chart/helfi_media_chart.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- drupal:media
- drupal:media_library
- drupal:path
- helfi_base_content:helfi_base_content
- drupal:text
- helfi_ckeditor:helfi_ckeditor
- helfi_media:helfi_media
'interface translation project': helfi_media_chart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ content:
region: content
settings: { }
third_party_settings: { }
unit_picture_caption:
type: string_textarea
weight: 5
region: content
settings:
rows: 5
placeholder: ''
third_party_settings: { }
www:
type: readonly_field_widget
weight: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ content:
settings:
link_to_entity: false
third_party_settings: { }
weight: 14
weight: 15
region: content
accessibility_phone:
type: string
label: above
settings:
link_to_entity: false
third_party_settings: { }
weight: 13
weight: 14
region: content
accessibility_sentences:
type: tpr_accessibility_sentence
label: hidden
settings: { }
third_party_settings: { }
weight: 19
weight: 20
region: content
accessibility_www:
type: link
Expand All @@ -54,29 +54,29 @@ content:
rel: ''
target: ''
third_party_settings: { }
weight: 15
weight: 16
region: content
address:
type: address_plain
label: hidden
settings: { }
third_party_settings: { }
weight: 5
weight: 6
region: content
address_postal:
type: string
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
weight: 9
weight: 10
region: content
call_charge_info:
type: text_default
label: above
settings: { }
third_party_settings: { }
weight: 11
weight: 12
region: content
description:
type: text_default
Expand All @@ -91,7 +91,7 @@ content:
settings:
link_to_entity: false
third_party_settings: { }
weight: 8
weight: 9
region: content
field_content:
type: entity_reference_revisions_entity_view
Expand All @@ -100,7 +100,7 @@ content:
view_mode: default
link: ''
third_party_settings: { }
weight: 18
weight: 19
region: content
field_lower_content:
type: entity_reference_revisions_entity_view
Expand All @@ -109,21 +109,21 @@ content:
view_mode: default
link: ''
third_party_settings: { }
weight: 20
weight: 21
region: content
field_metatags:
type: metatag_empty_formatter
label: above
settings: { }
third_party_settings: { }
weight: 17
weight: 18
region: content
highlights:
type: tpr_connection
label: hidden
settings: { }
third_party_settings: { }
weight: 22
weight: 23
region: content
name:
type: string
Expand All @@ -146,15 +146,15 @@ content:
label: hidden
settings: { }
third_party_settings: { }
weight: 7
weight: 8
region: content
phone:
type: telephone_link
label: hidden
settings:
title: ''
third_party_settings: { }
weight: 6
weight: 7
region: content
picture_url:
type: imagecache_external_responsive_image
Expand All @@ -180,7 +180,7 @@ content:
settings:
link_to_entity: false
third_party_settings: { }
weight: 21
weight: 22
region: content
service_map_embed:
type: service_map_embed
Expand All @@ -190,15 +190,22 @@ content:
link_title: 'Open larger map'
target: true
third_party_settings: { }
weight: 10
weight: 11
region: content
services:
type: entity_reference_label
label: above
settings:
link: true
third_party_settings: { }
weight: 16
weight: 17
region: content
unit_picture_caption:
type: basic_string
label: hidden
settings: { }
third_party_settings: { }
weight: 5
region: content
www:
type: link
Expand All @@ -210,7 +217,7 @@ content:
rel: ''
target: ''
third_party_settings: { }
weight: 12
weight: 13
region: content
hidden:
created: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ hidden:
services: true
show_www: true
streetview_entrance_url: true
unit_picture_caption: true
www: true
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ hidden:
services: true
show_www: true
streetview_entrance_url: true
unit_picture_caption: true
www: true
22 changes: 22 additions & 0 deletions modules/helfi_tpr_config/helfi_tpr_config.install
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,25 @@ function helfi_tpr_config_update_9044(): void {
\Drupal::service('helfi_platform_config.config_update_helper')
->update('helfi_tpr_config');
}

/**
* UHF-8938: Add a field to tpr_unit and re-import configs.
*/
function helfi_tpr_config_update_9045() : void {
$unit_picture_caption = BaseFieldDefinition::create('string_long')
->setTranslatable(TRUE)
->setRevisionable(FALSE)
->setLabel(new TranslatableMarkup('Caption'))
->setDisplayOptions('form', [
'weight' => 5,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);

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

// Re-import 'helfi_tpr_config' configuration.
\Drupal::service('helfi_platform_config.config_update_helper')
->update('helfi_tpr_config');
}
11 changes: 11 additions & 0 deletions modules/helfi_tpr_config/helfi_tpr_config.module
Original file line number Diff line number Diff line change
Expand Up @@ -493,5 +493,16 @@ function helfi_tpr_config_entity_base_field_info(EntityTypeInterface $entity_typ
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
}
if ($entity_type->id() === 'tpr_unit') {
$fields['unit_picture_caption'] = BaseFieldDefinition::create('string_long')
->setTranslatable(TRUE)
->setRevisionable(FALSE)
->setLabel(new TranslatableMarkup('Caption'))
->setDisplayOptions('form', [
'weight' => 5,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
}
return $fields;
}
3 changes: 3 additions & 0 deletions modules/helfi_user_roles/helfi_user_roles.install
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ use Drupal\user\Entity\User;
*/
function helfi_user_roles_grant_permissions() : void {
$permissions = [
'anonymous' => [
'access content',
],
'admin' => [
// @user.
'access user profiles',
Expand Down

0 comments on commit 9365281

Please sign in to comment.