You are here

README.txt in Module Builder 8.3

Same filename in this branch
  1. 8.3 README.txt
  2. 8.3 module_builder_devel/README.txt
Same filename and directory in other branches
  1. 5 README.txt
  2. 6.2 README.txt
  3. 7.2 README.txt
  4. 7 README.txt
Module Builder
==============

Welcome to Module Builder!

Module Builder is a system that simplifies the process of creating code, by
creating files complete with scaffold code that can be filled in.

For example, for generating a custom module, simply fill out the form, select
the hooks you want and the script will automatically generate a skeleton module
file for you, along with PHPDoc comments and function definitions. This saves
you the trouble of looking at api.drupal.org 50 times a day to remember what
arguments and what order different hooks use. Score one for laziness! ;)

What Module Builder can create
------------------------------

Module builder can generate the following for a module:
- code files, containing hook implementations
- info file (.info.yml on Drupal 8)
- plugin classes
- PHPUnit test case classes
- content and config entity types
- services
- plugin types
- README file

Furthermore, complex subcomponents can generate multiple code elements:
- an admin settings form adds form builder functions and an admin permission
- router paths add menu/router items
- permission names add the scaffold for the permission definition (on D7 and,
  earlier, hook_permission(), on D8 a permissions.yml file)

Installing Module Builder
-------------------------

Install Module Builder with Composer, the same as any other Drupal module. This
will take care of installing Drupal Code Builder and other dependencies.

WARNING: Module Builder is a developer tool. It should NEVER be installed on a
production site, as it has the capability to write to the site's codebase.

Running code analysis
---------------------

Module Builder uses code analysis to build a list of all the different hooks,
plugins types, services, and so on, that are defined by Drupal core, and contrib
and custom modules.

You need to run this when you first install Module Builder, and you should run
this again each time you enable new modules, update modules, or add code to your
custom modules.

1. Go to Administration › Configuration › Development › Module Builder › Analyse
   code.
2. Click the 'Update code analysis' button.

Using Module Builder
--------------------

1. Go to Administration › Configuration › Development › Module Builder.
   (Note: you will require 'create modules' privileges to see this link.)
2. Enter a module name, description, and so on. Save the form.
3. Select the components you want to add from the different tabs.
4. Go to the "Generate" tab and watch your module's code generated
   before your eyes! ;)
5. Use the 'Write files' button to write the generated code to your file system.
   Alternatively, copy and paste the code into using the shown filenames in a
   <your_module> directory under one of the modules directories.
6. Start customizing it to your needs; most of the tedious work is
   already done for you! ;)
7. Your module is saved as an entity. You can return to it, change the
   components and generated the code again

Todo/wishlist
-------------

See the issue queue for this module on drupal.org, and the issue queue for
Drupal Code Builder on github:

- https://www.drupal.org/project/issues/module_builder
- https://github.com/drupal-code-builder/drupal-code-builder

CONTRIBUTORS
------------
* Owen Barton (grugnog2), Chad Phillips (hunmonk), and Chris Johnson
  (chrisxj) for initial brainstorming stuff @ OSCMS in Vancouver
* Jeff Robbins for the nice mockup to work from and some great suggestions
* Karthik/Zen/|gatsby| for helping debug some hairy Forms API issues
* Steven Wittens and David Carrington for their nice JS checkbox magic
* jsloan for the excellent "automatically generate module file" feature
* Folks who have submitted bug reports and given encouragement, thank you
  so much! :)

File

README.txt
View source
  1. Module Builder
  2. ==============
  3. Welcome to Module Builder!
  4. Module Builder is a system that simplifies the process of creating code, by
  5. creating files complete with scaffold code that can be filled in.
  6. For example, for generating a custom module, simply fill out the form, select
  7. the hooks you want and the script will automatically generate a skeleton module
  8. file for you, along with PHPDoc comments and function definitions. This saves
  9. you the trouble of looking at api.drupal.org 50 times a day to remember what
  10. arguments and what order different hooks use. Score one for laziness! ;)
  11. What Module Builder can create
  12. ------------------------------
  13. Module builder can generate the following for a module:
  14. - code files, containing hook implementations
  15. - info file (.info.yml on Drupal 8)
  16. - plugin classes
  17. - PHPUnit test case classes
  18. - content and config entity types
  19. - services
  20. - plugin types
  21. - README file
  22. Furthermore, complex subcomponents can generate multiple code elements:
  23. - an admin settings form adds form builder functions and an admin permission
  24. - router paths add menu/router items
  25. - permission names add the scaffold for the permission definition (on D7 and,
  26. earlier, hook_permission(), on D8 a permissions.yml file)
  27. Installing Module Builder
  28. -------------------------
  29. Install Module Builder with Composer, the same as any other Drupal module. This
  30. will take care of installing Drupal Code Builder and other dependencies.
  31. WARNING: Module Builder is a developer tool. It should NEVER be installed on a
  32. production site, as it has the capability to write to the site's codebase.
  33. Running code analysis
  34. ---------------------
  35. Module Builder uses code analysis to build a list of all the different hooks,
  36. plugins types, services, and so on, that are defined by Drupal core, and contrib
  37. and custom modules.
  38. You need to run this when you first install Module Builder, and you should run
  39. this again each time you enable new modules, update modules, or add code to your
  40. custom modules.
  41. 1. Go to Administration › Configuration › Development › Module Builder › Analyse
  42. code.
  43. 2. Click the 'Update code analysis' button.
  44. Using Module Builder
  45. --------------------
  46. 1. Go to Administration › Configuration › Development › Module Builder.
  47. (Note: you will require 'create modules' privileges to see this link.)
  48. 2. Enter a module name, description, and so on. Save the form.
  49. 3. Select the components you want to add from the different tabs.
  50. 4. Go to the "Generate" tab and watch your module's code generated
  51. before your eyes! ;)
  52. 5. Use the 'Write files' button to write the generated code to your file system.
  53. Alternatively, copy and paste the code into using the shown filenames in a
  54. directory under one of the modules directories.
  55. 6. Start customizing it to your needs; most of the tedious work is
  56. already done for you! ;)
  57. 7. Your module is saved as an entity. You can return to it, change the
  58. components and generated the code again
  59. Todo/wishlist
  60. -------------
  61. See the issue queue for this module on drupal.org, and the issue queue for
  62. Drupal Code Builder on github:
  63. - https://www.drupal.org/project/issues/module_builder
  64. - https://github.com/drupal-code-builder/drupal-code-builder
  65. CONTRIBUTORS
  66. ------------
  67. * Owen Barton (grugnog2), Chad Phillips (hunmonk), and Chris Johnson
  68. (chrisxj) for initial brainstorming stuff @ OSCMS in Vancouver
  69. * Jeff Robbins for the nice mockup to work from and some great suggestions
  70. * Karthik/Zen/|gatsby| for helping debug some hairy Forms API issues
  71. * Steven Wittens and David Carrington for their nice JS checkbox magic
  72. * jsloan for the excellent "automatically generate module file" feature
  73. * Folks who have submitted bug reports and given encouragement, thank you
  74. so much! :)