You are here

public function Base::setOption in Openlayers 7.3

Set an option.

Parameters

string|array $parents: TODO: Define how this has to look like if it is an array.

mixed $value: The value to set.

Return value

ObjectInterface The current object.

Overrides ObjectInterface::setOption

12 calls to Base::setOption()
Base::addObject in src/Types/Base.php
Add an object into the collection of the parent object.
Base::removeObject in src/Types/Base.php
Remove an object from the collection.
Group::optionsFormSubmit in src/Plugin/Layer/Group/Group.php
Submit callback for the options form.
Layer::setOpacity in src/Types/Layer.php
Set the opacity of the layer.
Layer::setSource in src/Types/Layer.php
Set the source of this layer.

... See full list

File

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

Class

Base
Class Base.

Namespace

Drupal\openlayers\Types

Code

public function setOption($parents, $value = NULL) {
  $ref =& $this->options;
  if (is_string($parents)) {
    $parents = array(
      $parents,
    );
  }
  foreach ($parents as $parent) {
    if (isset($ref) && !is_array($ref)) {
      $ref = array();
    }
    $ref =& $ref[$parent];
  }
  $ref = $value;
  return $this;
}