Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function postBuild(array &$build, ObjectInterface $context = NULL)
 {
     $build['Debug'] = array('#type' => 'fieldset', '#title' => 'Map debug', '#description' => 'Here\'s a quick view of all the objects in the map.', '#collapsible' => TRUE, '#collapsed' => TRUE);
     foreach ($context->getCollection()->getObjects() as $type => $objects) {
         $build['Debug'][$type] = array('#type' => 'fieldset', '#title' => 'Type ' . $type . ':', '#collapsible' => TRUE, '#collapsed' => FALSE);
         foreach ($objects as $object) {
             $build['Debug'][$type][$object->machine_name] = array('#type' => 'fieldset', '#collapsible' => TRUE, '#collapsed' => TRUE, '#title' => $object->machine_name, 'configuration' => $this->getInfo($object));
         }
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function preBuild(array &$build, \Drupal\openlayers\Types\ObjectInterface $context = NULL)
 {
     // Auto-detect the source to use for the features.
     if (empty($this->options['source'])) {
         foreach ($context->getCollection()->getObjects('source') as $source) {
             if ($source instanceof \Drupal\openlayers\Source\Geofield) {
                 $this->setOption('source', $source->machine_name);
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function preBuild(array &$build, ObjectInterface $context = NULL)
 {
     foreach ($context->getCollection()->getObjects('layer') as $layer) {
         if ($layer->getMachineName() == $this->getOption('editLayer', FALSE)) {
             if ($source = $layer->getSource()) {
                 if ($source instanceof Vector) {
                     $geom = $this->initialDataToGeomFeatures();
                     $source->setOption('features', $geom['features']);
                 }
             }
         }
     }
 }