how can I access site configuration when in Drush command?
Global variable $config === null
and when I use Config::get('key')
, I get
Error: Using $this when not in object context in Drupal\Core\Config\Config::get() (line 85 of /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Config/Config.php)`
What is the recommended approach? I can't find it anywhere... thank you!
Edit
I actually intended to access Settings, not Config - that's where the confusion came from. Settings::get()
works just fine. To get data from config, just follow the accepted answer.