You are here

public function ChartsDefaultSettings::getDefaults in Charts 8.4

Same name and namespace in other branches
  1. 8.3 src/Settings/ChartsDefaultSettings.php \Drupal\charts\Settings\ChartsDefaultSettings::getDefaults()
  2. 5.0.x src/Settings/ChartsDefaultSettings.php \Drupal\charts\Settings\ChartsDefaultSettings::getDefaults()

Gets defaults settings.

Parameters

bool $new_format: Whether to return the new format or not.

Return value

array The defaults settings.

File

src/Settings/ChartsDefaultSettings.php, line 101

Class

ChartsDefaultSettings
The chart default settings instance.

Namespace

Drupal\charts\Settings

Code

public function getDefaults($new_format = FALSE) {
  $defaults = $this->defaults;

  // Transforming the legacy settings array to the newer one by making sure
  // that we don't do this process twice.
  if ($new_format && empty($defaults['display'])) {
    $keys_mapping = self::getLegacySettingsMappingKeys();
    $keys_mapping['colors'] = 'display_colors';
    $defaults = self::transformLegacySettingsToNew($defaults, $keys_mapping);
  }
  return $defaults;
}