21
September
You can get config value in any custom code using following method
Example 1
$phone = \Drupal::config('socialmedia.settings')->get('phone');
In above example "socialmedia.settings" is const which has been defined in configuration form and "phone" is variable where stored value
Will get value which have beed set through configuration form.
Example 2
$slogan = \Drupal::config('system.site')->get('slogan');
$config = \Drupal::service('config.factory')->getEditable('socialmedia.settings'); $config->set('phone', '9999999999')->save();
In above example "socialmedia.settings" is const which has been defined in configuration form and "phone" is variable where will store value
© 2023.ZedAngle. All Rights Reserved.