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

OEL-3178: Add maps version 3.0 #254

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

OEL-3178: Add maps version 3.0 #254

wants to merge 11 commits into from

Conversation

drishu
Copy link
Contributor

@drishu drishu commented Oct 11, 2024

OEL-3178

Description

Add support for maps version 3

Change log

  • Added: Config form
  • Changed: field widget

@drishu drishu changed the base branch from master to 2.x October 23, 2024 12:44
@drishu drishu changed the base branch from 2.x to master October 23, 2024 12:46
Copy link
Contributor

@brummbar brummbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need a new major, we can provide an update path that creates the configuration and sets it to 2.0 for existing installations. New installations can be on 3.0. Sites like EWPP can stick on 2.0 by exporting the configuration.

@@ -0,0 +1,2 @@
administer webtools maps form:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path: '/admin/config/system/oe_webtools_maps'
defaults:
_form: 'Drupal\oe_webtools_maps\Form\WebtoolsMapsSettingsForm'
_title: 'Webtools Maps Form settings'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_title: 'Webtools Maps Form settings'
_title: 'Webtools Maps settings'

Drop the form a bit everywhere :)

mapping:
map_version:
type: string
label: 'Map Version'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label: 'Map Version'
label: 'Map version'

@piotrsmykaj
Copy link

piotrsmykaj commented Dec 9, 2024

Hello @drishu,

  • Here is missing oe_webtools_maps.links.menu.yml and the settings form page is not visible on the Admin Configuration page.
  • Consider creating a hook_post_update() and set version 2.0 for the existing websites.

@@ -1,3 +1,11 @@
oe_webtools_maps.settings:
type: config_object
label: 'Webtools Maps Settings'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label: 'Webtools Maps Settings'
label: 'Webtools Maps settings'

'2.0' => $this->t('Version 2.0'),
'3.0' => $this->t('Version 3.0'),
],
'#default_value' => $config->get('map_version') ?? '2.0',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piotrsmykaj no need for "hook_post_update() and set version 2.0 for the existing websites." as we have this here

@sergepavle
Copy link
Member

sergepavle commented Jan 16, 2025

Unfortunately, somehow, I overlooked this PR regarding the webtools map upgrade and worked on almost the same independently. See PR: #258.
It doesn't have BC but in my PR implemented some changes regarding webtools Map 3 API changes (missed in this PR).
Here https://github.com/openeuropa/oe_webtools/pull/258/files#diff-d5788593f82f730c0aae0cc4840492e4a812488fa1fb087015bec48283327268L90 you may notice that in new version UEC had a new structure like layers.markers[0].data instead of layers[0].markers (as worked before). Without that markers
will not be shown.
Maybe you could also extend test coverage by reusing these changes: https://github.com/openeuropa/oe_webtools/pull/258/files#diff-93e9dfce3433d92e9cae1a182d4fb153f8b8169475098c75580da33298e5a187R1 to make sure that formatted settings also was reflected in UEC webtools code.
Feel free to cherry-pick commits if you wish.


foreach ($items as $delta => $item) {
$data_array = [
'service' => 'map',
'version' => '2.0',
// Fallback to version 2.0 for BC.
'version' => $config->get('map_version') ?? '2.0',
'map' => [
'zoom' => $this->getSetting('zoom_level'),
'center' => [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ($this->getSetting('show_marker')) {
        $data_array['layers'] = [

should be updated according to changes in Webtools Maps UEC for maps 3.0. See this changes: https://github.com/openeuropa/oe_webtools/pull/258/files#diff-d5788593f82f730c0aae0cc4840492e4a812488fa1fb087015bec48283327268L90

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm that, without this change, the marker does not appear on the map.

/**
* Tests if changing configuration changes the map JSON.
*/
public function testConfigurationChanges(): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we didn't have at all test coverage for oe_webtools_maps probably it makes sense to extend test coverage to assert field formatter settings. See https://github.com/openeuropa/oe_webtools/pull/258/files#diff-93e9dfce3433d92e9cae1a182d4fb153f8b8169475098c75580da33298e5a187R71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants