You are here

function proj4js_load_definition in Proj4JS 7

Load a definition. The definition is made available in the client when behaviors load. Note due to Drupal loading behaviours in random order you need to call Drupal.behaviors.proj4js.attach yourself when your behaviours depend on the presence of the projection definitions. See the discussion in #1940410 for details.

Parameters

String $identifier: For example "EPSG:2056".

String $definition: Proj4 definition.

1 call to proj4js_load_definition()
proj4js_load_definitions in ./proj4js.module
Load a set of definitions where the identifier is the key of the array.

File

./proj4js.module, line 120
Main module file for the proj4js.module.

Code

function proj4js_load_definition($identifier, $definition) {
  static $included_definitions = array();
  if (!in_array($identifier, $included_definitions)) {
    libraries_load('proj4js');
    drupal_add_js(proj4js_load_definition_js_settings($identifier, $definition), 'setting');

    // Track previously loaded projections because they contain the same
    // settings anyway and emitting them twice does not yield a benefit.
    $included_definitions[] = $identifier;
  }
}