3

Like the title says, I want to access the sites default timezone.

Guess

Drupal::config('system.date')->get('timezone')['default']

is the right function. I really would love to know how to use the config-function. Is there a list with all the configs, settings or variables that can be called?

Whats the logic behind the keywords "system.date"? Is there a way to discover keywords by looking at the yml config structure? Can all values of them be returned?

1 Answer 1

2

Inspect the system.date configuration

You can navigate to the /admin/config/development/configuration/single/export path and inspect the configuration types and values. The default timezone is of type simple configuration and system.date is the cofiguration name.

Inspect all the configuration values

Go to /admin/config/development/configuration/full/export, here you can export all the active configuration, you can download and extract the bundle and then inspect the individual files. If you have the drush command line tool, you could use the command drush config:export.

Official Documentation

You should read the official documentation to better understand the logic behind the Configuration API. These are some links:

Simple Configuration API | Drupal 8 guide on Drupal.org

Configuration API | Drupal 8 guide on Drupal.org

Configuration API overview | Drupal 8 guide on Drupal.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.