You are here

public function Field::getJS in Openlayers 7.3

!Attention! This function will remove any option that is named after a plugin type e.g.: layers, controls, styles, interactions, components .

Overrides Base::getJS

File

modules/openlayers_field/src/Plugin/Source/Field/Field.php, line 128
Source: Field.

Class

Field
Class Field.

Namespace

Drupal\openlayers_field\Plugin\Source\Field

Code

public function getJS() {
  $js = parent::getJS();
  $features = $this
    ->getGeojsonFeatures();
  if (!empty($features)) {
    $js['opt']['geojson_data'] = array(
      'type' => 'FeatureCollection',
      'features' => $features,
    );
  }
  unset($js['opt']['fields']);
  return $js;
}