Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Deactivated plugin still being used with Grav 1.7

Solved by pamtbaau View solution

Started by maxime 5 years ago · 16 replies · 685 views
5 years ago

I have this plugin installed : enovision/grav-frontend-edit-button: GRAV CMS Plugin - Frontend Edit Button (github.com)

I wanted to deactivate it, so I went to the yaml file that has the name of the plugin and turned the enabled property to false, cleared the cache, but the plugin is still being used.

enabled: false

Disabling the same plugin was working great with 1.6. I am using 1.7.7 now.

I created an issue for that plugin, but it seems to me that deactivation should be handled by Grav itself, not the plugins (it should be Grav's responsability to be able deactivate code that is broken or not needed, shouldn't it?)

Hope you could help me understanding and fixing this issue.

Regards,

Maxime

5 years ago

@mathmax, Using Grav 1.7.7, I've installed the plugin, but cannot reproduce the issue.

When enabling/disabling plugin in '/user/config/plugins/frontend-edit-plugin.yaml' (or '/user/plugins/frontend-edit-plugin/frontend-edit-plugin.yaml' in absence of the former config file) the following happens:

  • enabled: false
    no button shown and debugger does not get activated in onPluginsInitialized()
  • enabled: true
    button is shown and debugger gets activated in onPluginsInitialized()

What tells you it is still working when using enabled: false?

last edited 03/18/21 by pamtbaau
5 years ago

@pamtbaau Thank you for your reply.

After I connect to the admin and go back to the frontend of my website, the button added by the plugin is visible on the top right end corner of each page (see attachment).

Capture_frontendEdit|690x475

5 years ago

@mathmax, Cannot reproduce that either...

Steps:

  1. set enable: true in ‘/user/config/plugins/frontend-edit-plugin.yaml’ using file editor.
  2. browse to home page
    • button is visible, debugger activated in onPluginsInitialized()
  3. set enabled: false in ‘/user/config/plugins/frontend-edit-plugin.yaml’ using file editor.
  4. browse to Admin and login
  5. browse to home page of site
    • no button visible, debugger not activated in onPluginsInitialized()
last edited 03/18/21 by pamtbaau
5 years ago

Strange, I followed the same steps, button is still here...

step4: I was already loging after step 1 (to be able to see the button), so I did not need to login again to the admin. Should I log off and login again? Instead I just cleared the cache.

Step5: Have you tried to browse a few pages of the website? Doesn't the button reappear?

How do you see if the debugger is activated or not?

5 years ago

@mathmax,

Step5: Have you tried to browse a few pages of the website? Doesn’t the button reappear?

I'm using a fresh install of Grav 1.7.8 (just upgraded few minutes ago) and browsed both 'home' and 'typography'. Button does not reappear.

Questions:

  • Does the cache of your browser get cleared when you browse a page?
  • What's the path of the config file you are editing?

How do you see if the debugger is activated or not?

You need to have XDebug installed and activate debugging in your code editor (e.g. VSCode).

last edited 03/18/21 by pamtbaau
5 years ago

@pamtbaau:
Does the cache of your browser get cleared when you browse a page?

Yes, I did I checked in a new InPrivate window

@pamtbaau:
What’s the path of the config file you are editing?

user\plugins\frontend-edit-button\frontend-edit-button.yaml

What else can I do to investigate?

5 years ago

@mathmax, Does the site perhaps contain file '/user/config/plugins/frontend-edit-button.yaml', or a config file for specific environments like localhost?

last edited 03/18/21 by pamtbaau
5 years ago

Indeed it has! And that fixed my problem, thank you. 😊
Sorry for the time to install and try the plugin...
Questions:

  • is there some change in Grav 1.7 causing the files in user/config/plugins to have priority over the conf files directly in the plugins directories? It's good to be able to override the configuration of a specific plugin, but I am wondering why this configuration suddenly started to apply after I upgraded... I had forgotten I had this file there.
  • does the file in user/config/plugins completely replace the file in the pluging folder if it exists, or does only the configuration specified inside the file override the configuration of the plugin? In other words, does the ovverride apply on a per-file basis or per-property basis?
5 years ago Solution

@mathmax, Would you mind sharing what I can improve in all my posts to get more emphasis on file ‘/user/config/plugins/frontend-edit-plugin.yaml’? 😇

  • Settings in config files in 'user/config/plugins' have always had priority over 'user/plugins/...'
  • As said in the docs about Configuration:

    • In chapter System Configuration about '/user/config/system.yaml':

      Any setting in this file with the same structure and naming will override the setting provided in the default system configuration file.

    • In chapter Plugin Configuration about configs in 'user/config/plugins/...':

      The YAML file that exists within the plugin's primary directory will act as a fallback. Any settings listed there and not in the User folder's copy will be picked up and used by Grav.

    And also:

    Most plugins will come with their own YAML configuration file. We recommend copying this file to the user/config/plugins/ directory rather than editing configuration options directly to the file located in the plugin's directory. Doing this will ensure that an update to the plugin will not overwrite your settings, and keep all of your configurable options in one, convenient place.

5 years ago

@pamtbaau:
When enabling/disabling plugin in ‘/user/config/plugins/frontend-edit-plugin.yaml’ (or ‘/user/plugins/frontend-edit-plugin/frontend-edit-plugin.yaml’ in absence of the former config file) the following happens:

This was pretty clear, but I missed the path for some reason. Sorry about that 😓.

Instead of copying the whole file like advised by the documentation, I would prefer to only copy the settings that I want to change (in this case enabled: false). Thank you.

5 years ago

@mathmax:
Instead of copying the whole file like advised by the documentation, I would prefer to only copy the settings that I want to change

If you were to use Admin, keep in mind, that saving settings will still save all the values present in form

5 years ago

@Karmalakas, Good addition to the above and also an annoying 'feature' of Admin...

5 years ago

This is almost the only thing I always found annoying with the Admin... it messes up also the YAML FrontMatter of the pages (changing the attributes order, the format of the value, adding default values, etc.). This causes file changes which you don't want when files are kept under a version control system. It defeats a bit the strength of a flat file CMS which is to keep everything under revision control...

5 years ago

I guess you can avoid saving of each value (at least to some extent) with toggleable: true

5 years ago

Probably the same :) If you look at common field attributes, there's:

toggleable: add a checkbox that will toggle the enabled/disabled attribute of the field

If this is true, checkbox is rendered at the left of the field. If checkbox is not checked, the value is not saved to frontmatter (I assume same for configs). Only if checkbox is checked, then value is saved.

last edited 03/19/21 by Karmalakas

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 85 13 hours ago
General · by pamtbaau, 18 hours ago
1 60 17 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 350 5 days ago
General · by Duc , 6 days ago
3 44 5 days ago