A single module class may be registered with the CMS.
-
Create a new module class.
This must implementCzim\CmsCore\Contracts\Modules\ModuleInterface.
It is advisable to set a key that is unlikely to cause conflicts with other modules or generators. -
Create service providers as needed.
This is not required, but is highly recommended if your module requires provision that is not needed for non-CMS requests.
-
Register the module in the
cms-modules.phpconfig.
Add the fully qualified namespace for the module class to thecms-modules.modulesarray. -
If relevant, add service providers to the
cms-modules.phpconfig.
Add the fully qualified namespaces for any service providers to thecms-modules.providersarray.
Instead of coding concrete module classes, it is possible to register a module generator with the CMS. This may generate any number of modules procedurally, which will then each be registered with the CMS.
For an example of a module generator, see the models module generator.
-
Create a new module generator class.
This must implementCzim\CmsCore\Contracts\Modules\ModuleGeneratorInterface.
It is advisable to set a key that is unlikely to cause conflicts with other modules or generators. -
Create service providers as needed.
This is not required, but is highly recommended if your module requires provision that is not needed for non-CMS requests.
The proces is the same as for installing modules as described above.
The only difference is that the generator FQN is registered in cms-modules.modules instead of a module class.
If you're using the models module,
avoid setting the associatedClass module property to an Eloquent model.
This package relies on looking up (generated) modules by their Eloquent model classname.
As long as there are duplicates, you should be fine.