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

Add a hint on how to override local developed mapcontrols within config.template.js #347

Open
Raruto opened this issue Feb 16, 2023 · 0 comments
Labels
config Anything related to configuration files docs Improvements or additions to documentation

Comments

@Raruto
Copy link
Collaborator

Raruto commented Feb 16, 2023

As per v3.8, through the config.js file it is possible to extend the "initConfig->group->plugins" variable for custom plugin development (NB additively, i.e. without completely wiping the configuration received from the server):

const G3W_PLUGINS = [ // override "initConfig->group->plugins" attribute for custom plugin development
// "your-plugin-folder-name-1",
// "your-plugin-folder-name-2",
// "your-plugin-folder-name-3",
];

Find out a clean and smart way (ref. variable name) to do the same with mapcontrols to extend / list the mapcontrols we intend to develop locally.

If effective, in the near future, this method could also be used to write specific tests for a single mapcontrol.

Draft implementation

// config.js

const G3W_CONTROLS = [ // overwrite "initConfig->group->mapcontrols" attribute for custom mapcontrol development
  // "zoomtoextent",
  // "zoom",
  // "zoombox",
  // "query",
  "querybbox",
  "querybypolygon",
  "querybydrawpolygon",
  // "overview",
  // "scaleline",
  // "geolocation",
  // "nominatim",
  // "addlayers",
  // "length",
  // "area",
  // "mouseposition",
  // "scale",
  // "screenshot",
  // "geoscreenshot"
];

...

  devConfig: function() {
    g3wsdk.core.ApplicationService.once('initconfig', () => {
      initConfig.group.mapcontrols = G3W_CONTROLS || initConfig.group.mapcontrols;
    });
  }

Related to:

@Raruto Raruto added docs Improvements or additions to documentation config Anything related to configuration files labels Feb 16, 2023
@Raruto Raruto changed the title Add hint to override local developed mapcontrols within config.template.js Add a hint on how to override local developed mapcontrols within config.template.js Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Anything related to configuration files docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant