You are here

public function ThemeSettings::overridesValue in Express 8

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

File

themes/contrib/bootstrap/src/ThemeSettings.php, line 231
Contains \Drupal\bootstrap\ThemeSettings.

Class

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

Namespace

Drupal\bootstrap

Code

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,
  ]);
}