1

I've made a new plugin for Craft 3 using https://pluginfactory.io/, including everything possible just in case I needed it. Now that my project is coming to a close I'm going back through to take out what I didn't end up needing (I now realize this was not the wisest way). I can't seem to take out the Settings and Control Panel sections, even though my composer.json has:

...
"extra": {
  "hasCpSettings": false,
  "hasCpSection": false,
}
...

I'm not redeclaring those as true anywhere else...is there something else I should do to remove those parts?

2

Craft itself is caching this data. Once you've removed those lines from your composer.json file, you'll also need to remove them from the cached plugins.php file in Craft.

Open this file...

/vendor/craftcms/plugins.php

Then find your plugin. Remove the relevant lines from there, and save the file.


For this reason I actually recommend declaring hasCpSettings and hasCpSection the "old fashioned way"... within your plugin's main PHP file.

Yes, it's possible to declare those values via PHP as well. And if you declare them via PHP, they won't get cached in Craft's plugins.php file.

https://docs.craftcms.com/api/v3/craft-base-plugintrait.html#property-hascpsection https://docs.craftcms.com/api/v3/craft-base-plugintrait.html#property-hascpsettings

| improve this answer | |
  • Awesome, thank you! – jtenclay Jun 4 '18 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.