diff --git a/charts.services.yml b/charts.services.yml index 62955403a116516d5f02288d515f28b0ff613187..ae62187d60f613080c8e1c5bee618929e4aa86ea 100644 --- a/charts.services.yml +++ b/charts.services.yml @@ -7,3 +7,7 @@ services: charts.views_variable: class: Drupal\charts\Services\ViewsDataService + + charts.settings: + class: Drupal\charts\Services\ChartsSettingsService + arguments: ['@config.factory'] \ No newline at end of file diff --git a/src/Services/ChartsSettingsService.php b/src/Services/ChartsSettingsService.php new file mode 100644 index 0000000000000000000000000000000000000000..2864c19b7edcc3b344e98ce76d3a4300faa59a91 --- /dev/null +++ b/src/Services/ChartsSettingsService.php @@ -0,0 +1,21 @@ +<?php + +namespace Drupal\charts\Services; + +use Drupal\Core\Config\ConfigFactory; + +class ChartsSettingsService implements ChartsSettingsServiceInterface{ + + //private $editableConfigName = 'charts.settings'; + private $configFactory; + + public function __construct(ConfigFactory $config_factory){ + $this->configFactory = $config_factory; + } + + public function getChartsSettings(){ + $config = $this->configFactory->getEditable('charts.settings'); + + return $config->get('charts_default_settings'); + } +} \ No newline at end of file diff --git a/src/Services/ChartsSettingsServiceInterface.php b/src/Services/ChartsSettingsServiceInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..07ab16fdc004734803ea149e3530fc52d0f36655 --- /dev/null +++ b/src/Services/ChartsSettingsServiceInterface.php @@ -0,0 +1,10 @@ +<?php + + +namespace Drupal\charts\Services; + + +interface ChartsSettingsServiceInterface { + + public function getChartsSettings(); +} \ No newline at end of file