You are here

public function Base::initCollection in Openlayers 7.3

Initializes the Collection, Import objects from options, Import the current object.

Overrides ObjectInterface::initCollection

1 call to Base::initCollection()
Base::init in src/Types/Base.php
Initializes the object.

File

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

Class

Base
Class Base.

Namespace

Drupal\openlayers\Types

Code

public function initCollection() {
  if (is_null($this->collection) || !$this->collection instanceof Collection) {
    $this->collection = \Drupal::service('openlayers.Types')
      ->createInstance('Collection');
  }
  $this
    ->getCollection()
    ->import($this
    ->optionsToObjects());
  $this
    ->getCollection()
    ->append($this);
  return $this;
}