You are here

private function ChartsDefaultSettings::getSettingsFromDefaultConfig in Charts 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Settings/ChartsDefaultSettings.php \Drupal\charts\Settings\ChartsDefaultSettings::getSettingsFromDefaultConfig()

Get the settings from the YAML file in the config/install directory.

1 call to ChartsDefaultSettings::getSettingsFromDefaultConfig()
ChartsDefaultSettings::__construct in src/Settings/ChartsDefaultSettings.php
ChartsDefaultSettings constructor.

File

src/Settings/ChartsDefaultSettings.php, line 44

Class

ChartsDefaultSettings
The chart default settings instance.

Namespace

Drupal\charts\Settings

Code

private function getSettingsFromDefaultConfig() {
  $path = __DIR__ . '/../../config/install/charts.settings.yml';
  $default_config = Yaml::parse(file_get_contents($path))['charts_default_settings'];
  $defaults = [
    'type' => $default_config['type'],
    'library' => $default_config['library'],
    'grouping' => FALSE,
    'label_field' => NULL,
    'data_fields' => NULL,
    'field_colors' => NULL,
    'colors' => $default_config['display']['colors'],
    'title' => $default_config['display']['title'],
    'title_position' => $default_config['display']['title_position'],
    'data_labels' => $default_config['display']['data_labels'],
    'data_markers' => $default_config['display']['data_markers'],
    'legend' => $default_config['display']['legend'],
    'legend_position' => $default_config['display']['legend_position'],
    'background' => $default_config['display']['background'],
    'three_dimensional' => $default_config['display']['three_dimensional'],
    'polar' => $default_config['display']['polar'],
    'tooltips' => $default_config['display']['tooltips'],
    'tooltips_use_html' => $default_config['display']['tooltips_use_html'],
    'width' => $default_config['display']['dimensions']['width'],
    'width_units' => $default_config['display']['dimensions']['width_units'],
    'height' => $default_config['display']['dimensions']['height'],
    'height_units' => $default_config['display']['dimensions']['height_units'],
    'xaxis_title' => $default_config['xaxis']['title'],
    'xaxis_labels_rotation' => $default_config['xaxis']['labels_rotation'],
    'yaxis_title' => $default_config['yaxis']['title'],
    'yaxis_min' => $default_config['yaxis']['min'],
    'yaxis_max' => $default_config['yaxis']['max'],
    'yaxis_prefix' => $default_config['yaxis']['prefix'],
    'yaxis_suffix' => $default_config['yaxis']['suffix'],
    'yaxis_decimal_count' => $default_config['yaxis']['decimal_count'],
    'yaxis_labels_rotation' => $default_config['yaxis']['labels_rotation'],
    'green_to' => $default_config['display']['gauge']['green_to'],
    'green_from' => $default_config['display']['gauge']['green_from'],
    'yellow_to' => $default_config['display']['gauge']['yellow_to'],
    'yellow_from' => $default_config['display']['gauge']['yellow_from'],
    'red_to' => $default_config['display']['gauge']['red_to'],
    'red_from' => $default_config['display']['gauge']['red_from'],
    'max' => $default_config['display']['gauge']['max'],
    'min' => $default_config['display']['gauge']['min'],
  ];
  return $defaults;
}