You are here

function _site_settings_retrieve_deep_value in Site Settings and Labels 8

Retrieve a deep value from our multidimensional array.

Parameters

array|string $settings: The settings data to be accessed.

array $keys: A series of keys, the first one for the top level, the second one for the second level, etc.

Return value

string The final value.

1 call to _site_settings_retrieve_deep_value()
site_settings_tokens in ./site_settings.tokens.inc
Implements hook_tokens().

File

./site_settings.tokens.inc, line 166
Builds placeholder replacement tokens for node-related data.

Code

function _site_settings_retrieve_deep_value($settings, array $keys) {
  if ($keys) {
    $next_key = array_shift($keys);
    if (isset($settings[$next_key]) && is_array($keys)) {
      return _site_settings_retrieve_deep_value($settings[$next_key], $keys);
    }
    else {
      return t('Setting not found');
    }
  }
  return $settings;
}