You are here

function SearchByPageService::getSetting in Search by Page 8

Returns a setting for Search by Page or a sub-module. [D8 ported] search_by_page_setting_get() in .module file.

This is like the Drupal \Drupal::state()->get() function, except that it is environment-aware.

Parameters

$name: Name of the setting.

$environment: ID of the environment.

$default: Default value to return if setting has not been defined.

Return value

Setting value, or $default if not defined.

See also

\Drupal::service('search_by_page.settings')->setSetting()

File

src/Services/SearchByPageService.php, line 91
Search By Page Service and helper methods.

Class

SearchByPageService

Namespace

Drupal\search_by_page\Services

Code

function getSetting($name, $environment, $default) {
  $stuff = \Drupal::state()
    ->get('search_by_page_settings', []);
  if (isset($stuff[$environment][$name])) {
    return $stuff[$environment][$name];
  }
  return $default;
}