function Settings::get
Same name in this branch
- main core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
- 10 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
- 9 core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
- 8.9.x core/lib/Drupal/Core/Site/Settings.php \Drupal\Core\Site\Settings::get()
- 11.x core/themes/admin/src/Settings.php \Drupal\admin\Settings::get()
Get the setting for the current user.
Parameters
string $name: The name of the setting.
\Drupal\Core\Session\AccountInterface|null $account: The account object. Current user if NULL.
Return value
array|bool|mixed|null The current value.
File
-
core/
themes/ admin/ src/ Settings.php, line 86
Class
- Settings
- Service to handle overridden user settings.
Namespace
Drupal\adminCode
public function get(string $name, ?AccountInterface $account = NULL) : mixed {
$value = NULL;
if (!$account) {
$account = $this->currentUser;
}
if ($this->userOverrideEnabled($account)) {
$settings = $this->userData
->get('admin', $account->id(), 'settings');
$value = $settings[$name] ?? $this->userData
->get('admin', $account->id(), $name);
}
if (is_null($value)) {
$admin_theme = $this->getAdminTheme();
$value = $this->themeSettingsProvider
->getSetting($name, $admin_theme);
}
return $value;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.