over 9 years ago
Creating module is easy in drupal
Steps you need to follows are as below.
Where does your custom module goes?
Its always better to keep contrib and custom modules seperate. So your module should goes under custom folder
site->all->modules->custom->
under this folder you should have at-least two files .info and .module file.
.info and .module should have the same name as your module folder name.
example
If you module folder name is myfistmodule then you should have myfistmodule.info and myfistmodule.module.
Drupal uses .info files to store metadata about modules.
For modules, the .info file is used for:
- rendering information on the Drupal Web GUI administration pages;
- providing criteria to control module activation and deactivation;
- notifying Drupal about the existence of a module;
- general administrative purposes in other contexts.
rendering information on the Drupal Web GUI administration pages;
providing criteria to control module activation and deactivation;
notifying Drupal about the existence of a module;
general administrative purposes in other contexts.
myfirstmodule.info
The .info file can contain the following properties:
- name /*required*/
- description /*recommended*/
- core /*required*/
- stylesheets
- scripts
- files
- dependencies
- package
- php
- version /*discouraged */
- configure
- required
- hidden
- project /*discouraged, packaging use only*/
- project status url /*only used for custom modules not submitted to drupal.org*/
name /*required*/ description /*recommended*/ core /*required*/ stylesheets scripts files dependencies package php version /*discouraged */ configure required hidden project /*discouraged, packaging use only*/ project status url /*only used for custom modules not submitted to drupal.org*/
More details about each property could be found on https://www.drupal.org/node/542202
that's all you need in .info file
myfirstmodule.module file contains your php code
And this is all you need to create you first module in drupal.
By now your module should be available in module list . where you can enable/disable it.
0 Comment(s)