Custom plugin classes are not loaded before config/cms.php is executed #1283
-
Winter CMS Build1.2 PHP Version8.1 Database engineMySQL/MariaDB Plugins installedNo response Issue descriptionHi, In my Plugin structure: Error: Steps to replicateWorkaroundNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Since your directory is named in lowercase, your namespace should also be in lowercase. You should have some warnings from Composer's autoloader concerning PSR4 standards. I highly recommend changing the directory name to an uppercase H instead of changing the namespace though, as it's also part of PSR conventions. |
Beta Was this translation helpful? Give feedback.
-
@nmiyazaki-chapleau we actually do support the folders being lowercase and the class file being TitleCase, it's what all the first party modules and plugins do and it's what the scaffolding generates. @goldmont as for your original issue this is known and intentional. The config loader loads those files when the values are asked for. Plugin classes are not autoloaded until the plugin itself is registered and determined to be enabled so that disabled plugins do not have their code autoloaded. Since the System ServiceProvider loads the The solution is to make use of Furthermore at some point in the future we plan on refactoring how the CMS storage is configured so that it'll be done as real disks in filesystems.php instead of the current setup in the CMS config, so if you're interested in helping out with that I'd point you at #844 and wintercms/storm#141 |
Beta Was this translation helpful? Give feedback.
@nmiyazaki-chapleau we actually do support the folders being lowercase and the class file being TitleCase, it's what all the first party modules and plugins do and it's what the scaffolding generates.
@goldmont as for your original issue this is known and intentional. The config loader loads those files when the values are asked for. Plugin classes are not autoloaded until the plugin itself is registered and determined to be enabled so that disabled plugins do not have their code autoloaded.
Since the System ServiceProvider loads the
cms.loadModules
config item in order to determine which modules to load and register before it kicks off the plugin initialization it's expected that any plu…