You are here

public function Base::getOption in Openlayers 7.3

Returns an option.

Parameters

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

mixed $default_value: The default value to return if the option isn't set. Set to NULL if not defined.

Return value

mixed The value of the option or the defined default value.

Overrides ObjectInterface::getOption

77 calls to Base::getOption()
Attribution::optionsForm in src/Plugin/Control/Attribution/Attribution.php
@TODO What is this return? If it is the form, why is form by reference?
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.
BingMaps::optionsForm in src/Plugin/Source/BingMaps/BingMaps.php
@TODO What is this return? If it is the form, why is form by reference?
BootstrapjsAlert::optionsForm in src/Plugin/Component/BootstrapjsAlert/BootstrapjsAlert.php
@TODO What is this return? If it is the form, why is form by reference?

... See full list

File

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

Class

Base
Class Base.

Namespace

Drupal\openlayers\Types

Code

public function getOption($parents, $default_value = NULL) {
  if (is_string($parents)) {
    $parents = array(
      $parents,
    );
  }
  if (is_array($parents)) {
    $notfound = FALSE;
    if (!isset($this->options)) {
      $notfound = TRUE;
      $parents = array();
      $options = array();
    }
    else {
      $options = $this->options;
    }
    foreach ($parents as $parent) {
      if (isset($options[$parent])) {
        $options = $options[$parent];
      }
      else {
        $notfound = TRUE;
        break;
      }
    }
    if (!$notfound) {
      return $options;
    }
  }
  if (is_null($default_value)) {
    return FALSE;
  }
  return $default_value;
}