Problem/Motivation
When saving the config form for the module, hook_page_attachemnts (line 29) does not return the saved ID from the config.
If you dump out the config object, the ID exists correctly under `data` however, using `->get('id')` yields `null`
Steps to reproduce
Enable the module
Add an account ID into the `VWO Account ID` field at `/admin/config/system/vwo`
Save the form
View the front end of the site
Inspect the DOM
Search for 'vwo'
Nothing found
Proposed resolution
Strangely I have found that replacing line 28 (`$config = \Drupal::config('vwo.settings');`) with `$config = \Drupal::configFactory()->getEditable('vwo.settings');` does allow `$config->get('id')` to return the correct data from the object.
Both object have the correct ID data in the `data` property, but only the editable one is able to get to return the ID.
The other thing to note is that the immutable config does correctly pull back the other data that is stored, such as `filter` and `loading`, just not for `id`
Issue fork vwo-3377472
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
viren18febs commentedChecking the issue!
Comment #3
viren18febs commentedI have checked this issue in Drupal 9 & 10. after followed the Reproduce steps, I am able to get the 'vwo' in Inspect DOM & getting the id with this code. so we no need to change the code in hook_page_attachemnts().
Comment #4
viren18febs commentedComment #5
keshavv commented@James Hawthorn-Byng Not able to reproduce the issue. I am able to retrieve the ID from the configuration.
The method mentioned in solution
$config = \Drupal::configFactory()->getEditable('vwo.settings');will provide the override config value that is written in the settings.php file.