Skip to content

Commit

Permalink
Merge pull request #74 from andrebonon/issue-72-adds-translation-on-l…
Browse files Browse the repository at this point in the history
…ocation-views

fix: [#72] Adds translation on the location views
  • Loading branch information
podarok authored May 8, 2024
2 parents fb8f8a4 + 6183034 commit 7ace9c8
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 6 deletions.
39 changes: 39 additions & 0 deletions config/schema/openy_map.schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
openy_map.settings:
type: config_object
label: 'Openy Map Settings'
mapping:
default_tags:
type: sequence
label: 'Default Tags'
sequence:
type: string
label: 'Content Type'
translatable: true
block_labels:
type: sequence
label: 'Block Labels'
sequence:
type: label
label: 'Content Type'
translatable: true
type_labels:
type: sequence
label: 'Type Labels'
sequence:
type: label
label: 'Content Type'
translatable: true
active_types:
type: sequence
label: 'Active Types'
sequence:
type: label
label: 'Content Type'
translatable: true
type_icons:
type: sequence
label: 'Type Icons'
sequence:
type: string
label: 'Content Type'
translatable: true
42 changes: 41 additions & 1 deletion modules/openy_map_lb/config/install/views.view.locations_lb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,46 @@ display:
operator: ''
operator_limit_selection: false
operator_list: { }
default_langcode:
id: default_langcode
table: node_field_data
field: default_langcode
relationship: none
group_type: group
admin_label: ''
entity_type: node
entity_field: default_langcode
plugin_id: boolean
operator: '='
value: '1'
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
operator_limit_selection: false
operator_list: { }
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
filter_groups:
operator: AND
groups:
Expand All @@ -380,14 +420,14 @@ display:
empty: false
content: '<h2 class="location-title h1">{{ type }}</h2>'
tokenize: true
rendering_language: '***LANGUAGE_language_interface***'
display_extenders: { }
block_description: 'Locations Branches'
block_category: 'Paragraph Blocks'
block_hide_empty: true
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- 'user.node_grants:view'
Expand Down
23 changes: 23 additions & 0 deletions modules/openy_map_lb/openy_map_lb.install
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,26 @@ function openy_map_lb_update_91001() {
}
}
}

/**
* Adds default language condition to the view location.
*/
function openy_map_lb_update_91002() {
$config_dir = \Drupal::service('extension.path.resolver')->getPath('module', 'openy_map_lb') . '/config/install/';
// Update multiple configurations.
$configs = [
'views.view.locations_lb' => [
'display.locations_block.display_options.filters.default_langcode',
'display.locations_block.display_options.arguments.rendering_language',
'display.locations_block.cache_metadata.contexts'
],
];

$config_updater = \Drupal::service('openy_upgrade_tool.param_updater');
foreach ($configs as $config_name => $params) {
$config = $config_dir . $config_name . '.yml';
foreach ($params as $param) {
$config_updater->update($config, $config_name, $param);
}
}
}
4 changes: 2 additions & 2 deletions modules/openy_map_lb/templates/openy-map-lb.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="form-group">
<label for="search_field">{{ 'ENTER ZIP CODE or address'|t }}</label>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search by location" id="search_field" />
<input type="text" class="form-control" placeholder="{{ "Search by location"|t }}" id="search_field" />
<div class="input-group-append">
<button class="btn btn-primary" type="button" aria-label="{{ "Search"|t }}"><i class="fas fa-search"></i></button>
</div>
Expand Down Expand Up @@ -40,7 +40,7 @@
</div>
<div class="col-md-4 col-lg-4 filter-item text-center text-md-right mb-2">
<a class="btn btn-outline-light amenities-filter-control collapsed" data-toggle="collapse" href="#amenities-filter" role="button" aria-expanded="false" aria-controls="amenities-filter" >
{{ 'Filter by amenities' }} <i class="fas fa-plus"></i>
{{ 'Filter by amenities'|t }} <i class="fas fa-plus"></i>
</a>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions openy_map.config_translation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
openy_map.settings:
title: 'Openy Map Settings'
base_route_name: openy_map.settings
names:
- openy_map.settings
5 changes: 3 additions & 2 deletions openy_map.info.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Open Y Map
type: module
description: Renders a map with locations. Provides blocks for Locations page.
core_version_requirement: ^8 || ^9 || ^10
version: 1.15
core_version_requirement: ^9 || ^10
version: 5.1.1
package: Open Y
configure: openy_map.settings
dependencies:
- geolocation:geolocation
- openy_socrates:openy_socrates
Expand Down
2 changes: 1 addition & 1 deletion openy_map.install
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function openy_map_update_8008() {
->save(TRUE);
}

/**
/**
* Update path to icons.
*/
function openy_map_update_8009() {
Expand Down

0 comments on commit 7ace9c8

Please sign in to comment.