Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidjguru/590bf212c2a31528ea872a27f7bf3443 to your computer and use it in GitHub Desktop.
Save davidjguru/590bf212c2a31528ea872a27f7bf3443 to your computer and use it in GitHub Desktop.
Drupal 8 || 9 - Creating custom resources using `drush generate`

Mother Command

$ drush generate

Response

Drush generate 10.3.6
Run drush generate [command] and answer a few questions in order to write starter code to your project.

Available commands: [...]

Creating Custom Module

How to create a new custom standard module with Drush Generate.

Light Version

$ drush generate module-standard

Medium Version

$ drush gen module-standard --directory modules/custom --answers '{"name": "Custom Module for JavaScript"}'

Whole Version

$ drush gen module-standard --directory modules/custom \
--answers '{"name": "Custom Module for JavaScript", \
"machine_name": "javascript_custom_module", \
"description": "Custom Generated Module for JavaScript.", \
"package": "Custom", "dependencies": "", \
"install_file": "no", "libraries": "no", \
"permissions": "no", "event_subscriber": "no", \
"block_plugin": "no", "controller": "no", \
"settings_form": "no"}'

Reference Class to get the param naming

  • Class: Standard.php
  • Namespace: DrupalCodeGenerator\Command\Drupal_8\Module
  • Path: /vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/Standard.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment