function Settings::userOverrideEnabled

Same name and namespace in other branches
  1. 11.x core/themes/admin/src/Settings.php \Drupal\admin\Settings::userOverrideEnabled()

Determine if the user enabled overrides.

Parameters

\Drupal\Core\Session\AccountInterface|null $account: The account object. Current user if NULL.

Return value

bool TRUE, if the user has overridden theme settings, FALSE otherwise.

File

core/themes/admin/src/Settings.php, line 168

Class

Settings
Service to handle overridden user settings.

Namespace

Drupal\admin

Code

public function userOverrideEnabled(?AccountInterface $account = NULL) : bool {
  $overrides =& drupal_static(__CLASS__ . '_' . __METHOD__, []);
  if (!$account || !$this->userData) {
    $account = $this->currentUser;
  }
  if (!isset($overrides[$account->id()])) {
    $overrides[$account->id()] = $this->allowUserOverrides() && $this->userData
      ->get('admin', $account->id(), 'enable_user_settings');
  }
  return $overrides[$account->id()];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.