Closed (fixed)
Project:
Sticky Navigation
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
23 Jul 2016 at 19:56 UTC
Updated:
26 Jul 2016 at 20:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
davewilly commentedHere is a quick patch.
Comment #3
davewilly commentedComment #4
skein commentedHello
Thank you for your contribution, but I have tried to reproduce the issue with no success (although I do remember seeing that notice before). Although your fix will solve the issue it seems the issue is with the schema config, which does not return the correct default value, which should be an empty array. Strangely enough it did not happen to me, but may be it's due to my PHP or Server version.
Could you please provide the information about your installation so we can get to the root of the notice instead of treating a symptom.
Comment #5
davewilly commentedHey skein,
Drupal version : 8.1.7
PHP Version => 5.6.18-1+deb.sury.org~trusty+1
System => Linux drupalvm 4.2.0-41-generic #48~14.04.1-Ubuntu SMP Fri Jun 24 17:09:15 UTC 2016 x86_64
I've just retested after reinstalling module, and warning is there, screenshot attached.
Comment #6
davewilly commentedFurther info - after enabling the module and accessing /admin/config/user-interface/stickynav, $config->get('roles') returns NULL.
However after enabling stickynav for the current admin theme and saving (admin/config/user-interface/stickynav/seven/edit), $config->get('roles') returns an empty array as expected. It seems it requires a config save in order to return the empty array, or we just get NULL.
Comment #7
skein commentedIt seems that the stickynav module tries to check values even if the theme is not enabled. Technically the enabled key for the theme should prevent this. Possibly an issue in the initial condition.
Comment #8
davewilly commentedOk this try this one. $config->isNew() returns bool (TRUE) if the configuration object does not exist in storage.
If stickynav has not been enabled for the current theme, which will always be the case after enabling the module, we can check $config->isNew() and do nothing if TRUE.
For any active theme where stickynav has been enabled, $config->isNew() will be FALSE, so we can fetch the configs and attach the library etc.
See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Config%21...
Comment #9
davewilly commentedComment #10
skein commentedHello
I think I found the issue. It should check if the theme is enabled for stickynav first and then check the roles.
Please test the latest patch.
Comment #11
davewilly commentedYes looks good.
Comment #13
skein commentedGreat committed.