/** * {@inheritdoc} */ public function optionsFormSubmit($form, &$form_state) { parent::optionsFormSubmit($form, $form_state); $options = $this->getOptions(); foreach (Openlayers::getGeometryTypes() as $geometry_type => $geometry) { if ((bool) $options[$geometry_type]['enabled'] === FALSE) { unset($options[$geometry_type]); } } $this->setOptions($options); $form_state['values']['options'] = $options; parent::optionsFormSubmit($form, $form_state); }
/** * {@inheritdoc} */ public function optionsToObjects() { $import = parent::optionsToObjects(); if ($styles = $this->getOption('style', array())) { foreach ($styles as $style) { $style = Openlayers::load('style', $style); // This source is a dependency of the current one, // we need a lighter weight. $this->setWeight($style->getWeight() + 1); $import = array_merge($style->getCollection()->getFlatList(), $import); } } return $import; }