public function GeoJSON::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
- src/
Plugin/ Source/ GeoJSON/ GeoJSON.php, line 83 - Source: GeoJson.
Class
- GeoJSON
- Class GeoJSON.
Namespace
Drupal\openlayers\Plugin\Source\GeoJSONCode
public function getJS() {
$js = parent::getJS();
// Ensure we've a sane url.
if (!empty($js['opt']['url'])) {
$js['opt']['url'] = url($js['opt']['url']);
}
else {
// Remove the option as it is even used if empty.
unset($js['opt']['url']);
}
// @TODO Find a way how to do this just once per map / collection.
if ($this
->getOption('devMode')) {
include 'forms.inc';
$form_state = array();
$form_state['build_info']['args'] = array(
$this,
);
$form = drupal_build_form('openlayers_dev_dialog_form', $form_state);
unset($form['options']['devMode']);
$js['opt']['devDialog'] = filter_xss(drupal_render($form), array(
'label',
'form',
'input',
'select',
'textarea',
'div',
'ul',
'ol',
'li',
'dl',
'dt',
'dd',
));
}
return $js;
}