Exemplo n.º 1
0
 /**
  * Array containing basic information about an OL Object.
  *
  * @param \Drupal\openlayers\Types\ObjectInterface $object
  * @return array
  */
 protected function getInfo(ObjectInterface $object)
 {
     $js = $object->getJS();
     $info = array('mn' => array('#type' => 'item', '#title' => 'Machine name:', '#markup' => $object->getMachineName()), 'fs' => array('#type' => 'item', '#title' => 'Factory service:', '#markup' => $object->getFactoryService()));
     $plugin_description = $object->getPluginDescription();
     if (!empty($plugin_description)) {
         $info['pd'] = array('#type' => 'item', '#title' => 'Plugin description:', '#markup' => $plugin_description);
     }
     if (isset($js['opt'])) {
         $info['opt'] = array('#type' => 'item', '#title' => 'Options:', 'options' => array('#markup' => $this->toInfoArrayMarkup($js['opt'])));
     }
     return $info;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function addObject(ObjectInterface $object)
 {
     $this->setOption($object->getType() . 's', $this->getOption($object->getType() . 's', array()) + array($object->getMachineName()));
     $object->setWeight(count($this->getOption($object->getType() . 's', array())) + 2);
     $this->getCollection()->import(array($object));
     return $this;
 }
 /**
  * Remove object from this collection.
  *
  * @param \Drupal\openlayers\Types\ObjectInterface $object
  *   Object instance to remove from this collection.
  */
 public function delete(ObjectInterface $object)
 {
     unset($this->objects[$object->getType() . '_' . $object->getMachineName()]);
 }
Exemplo n.º 4
0
 /**
  * Add object to this collection.
  *
  * @param ObjectInterface $object
  *   Object instance to add to this collection.
  */
 public function prepend(ObjectInterface $object)
 {
     $this->objects = array_merge(array($object->getType() . '_' . $object->getMachineName() => $object), $this->objects);
 }