public static function Config::get in Openlayers 7.3
Fetches a configuration value.
Parameters
string|array $parents: The path to the configuration value. Strings use dots as path separator.
string|array $default_value: The default value to use if the config value isn't set.
Return value
mixed The configuration value.
9 calls to Config::get()
- Base::attached in src/
Types/ Base.php - Returns a list of attachments for building the render array.
- GeoJSON::attached in src/
Plugin/ Source/ GeoJSON/ GeoJSON.php - Returns a list of attachments for building the render array.
- OLMap::optionsForm in src/
Plugin/ Map/ OLMap/ OLMap.php - @TODO What is this return? If it is the form, why is form by reference?
- Openlayers::getAttached in src/
Openlayers.php - Returns the list of attached libraries or js/css files.
- Openlayers::getLibraryVersion in src/
Openlayers.php - Return the version of the Openlayers library in use.
File
- src/
Config.php, line 50 - Class Config.
Class
- Config
- Class Config.
Namespace
Drupal\openlayersCode
public static function get($parents, $default_value = NULL) {
$options = \Drupal::service('variable')
->get('openlayers_config', array());
if (is_string($parents)) {
$parents = explode('.', $parents);
}
if (is_array($parents)) {
$notfound = FALSE;
foreach ($parents as $parent) {
if (array_key_exists($parent, $options)) {
$options = $options[$parent];
}
else {
$notfound = TRUE;
break;
}
}
if (!$notfound) {
return $options;
}
}
$value = Config::defaults(implode('.', $parents));
if (isset($value)) {
return $value;
}
if (is_null($default_value)) {
return FALSE;
}
return $default_value;
}