May 20, 2019 in Drupal 8, Snippets

I will add some code snippets about how to create a custom configuration form in your back-end later. This snippet shows how to get the data added to these forms in your custom module. The following snippet shows how to get a boolean value, based on the saved configuration of a custom module :

$is_enabled = \Drupal::config('mymodule.settings')->get('enabled');
if($is_enabled === 1) {
  // do stuff