Miscellaneous form#
The Miscellaneous tab lets you various components, including:
- Services
- Event subscribers
- Events
- Permissions
- Theme hooks
- Libraries
- Drush commands
Services#
Services are classes which provide some sort of API, and which are obtained from the service container.
Click ‘Add a services item’. This adds a form section for the service.

Optionally, select a service type. This adds a service tag to your service, and makes your service implement a particular API, and the service will typically be collected by another service and its methods called by the collector.
Enter the service’s name. The module prefix will be added automatically when the module code is generated.
You can optionally have your service class decorate an existing service. This allows you to override the existing service’s behaviour.
You can add services to inject into the service class. The ‘Injected services’ form element has an autocomplete.
Event subscribers#
An event subscriber is a particular type of service that reacts to events. The Drupal event system is based on the Symfony event system.
The form section is the same as for services (see above), with the addition of a form element to select the names of events to listen to.
The generated event subscriber class will have a method for each selected event.
Events#
The events form section lets you define events that you can trigger in module code, and listen to with subscribers.
Click ‘Add an events item’. This adds a new row to the table.

Enter a name for the event. This should be a string in snake case. The generated code will automatically add the name of the module as a prefix.
Add a description for the event.
Service provider#
Enable the ‘Service provider’ checkbox to add a service provider class, which allows services to be defined dynamically.
Permissions#
Permissions allows your module to control which users have access to particular functions or pages.
Click ‘Add a permissions item’. This adds a form section for the permission.

Enter the machine name for the permission. This is the string that code that checks for access will use.
Enter the human-readable name for the permission. This is what is shown to admin users in the permissions UI.
Enter the description for the permission. This is also shown to admin users in the permissions UI.
If your permission should show a warning in the permissions UI because of what it grants access to, select the ‘Access warning’ checkbox.
Theme hooks#
Theme hooks allow you to add Twig templates to output your module’s content.
To add theme hooks, enter the name of the hook in the Theme hooks text area, one hook name per line.
Each theme hook will add:
- A definition in the return value of a hook_theme() implementation in your module.
- A basic Twig template for your theme hook.
Libraries#
Libraries are a way of attaching JavaScript and CSS files to a page. Each library can have one or more of both types of file.
Click ‘Add a Libraries item’. This adds a form section for the library.

Enter the machine name for the library.
The version number of a library should be incremented whenever its asset files change, so it can be left as the default of ‘1.x’.
Click ‘Add a CSS file item’ to add a stylesheet file. This adds a form section.

- Enter the filename.
- Select the stylesheet type.
Click ‘Add a JS file item’ to add a JavaScript file. This adds a form section.

- Enter the filename.
Enter any dependencies the library has.
Drush commands#
Drush is a command-line tool for managing a Drupal site. It can be extended with custom commands.
Click ‘Add a Drush commands item’. This adds a form section for the command.

Enter the command name. This is the string that is typed to execute the command.
Optionally, enter aliases for the command. These are typically abbreviated forms of the command name.
Enter a description for the command.
Optionally, enter the names of the command’s parameters. These are values that go directly after the command, for example:
drush mycommand param1 param2.Optionally, enter the names of the command’s options, and a default value. These are values that are specified with command line options, for example:
drush mycommand --option1=bar --option2=foo.