You are here

public function Base::addObject in Openlayers 7.3

Add an object into the collection of the parent object.

Parameters

\Drupal\openlayers\Types\ObjectInterface $object: The object to add.

Return value

ObjectInterface The parent object.

Overrides ObjectInterface::addObject

6 calls to Base::addObject()
Layer::setSource in src/Types/Layer.php
Set the source of this layer.
Layer::setStyle in src/Types/Layer.php
Set the style of this layer.
Map::addComponent in src/Types/Map.php
Map::addControl in src/Types/Map.php
Map::addInteraction in src/Types/Map.php

... See full list

File

src/Types/Base.php, line 196
Class Object.

Class

Base
Class Base.

Namespace

Drupal\openlayers\Types

Code

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;
}