function public function ThemeSettings::overridesValue

8.x-3.x ThemeSettings.php public ThemeSettings::overridesValue($name, $value)

Determines if a setting overrides the default value.

Parameters

string $name: The name of the setting to check.

mixed $value: The new value to check.

Return value

bool TRUE or FALSE

Class

ThemeSettings
Provides a configuration API wrapper for runtime merged theme settings.

Namespace

Drupal\bootstrap

Source src/ThemeSettings.php (line 332)

public function overridesValue($name, $value) {
  // Retrieve the currently stored value for comparison purposes.
  $current_value = $this->get($name);

  // Due to the nature of DiffArray::diffAssocRecursive, if the provided
  // value is an empty array, it cannot be iterated over to determine if
  // the values are different. Instead, it must be checked explicitly.
  // @see https://www.drupal.org/node/2771121
  if ($value === [] && $current_value !== []) {
    return TRUE;
  }

  // Otherwise, determine if value is overridden by any array differences.
  return !!DiffArray::diffAssocRecursive([$name => $value], [$name => $current_value]);
}