Skip to content

Instantly share code, notes, and snippets.

@olehi94
Last active January 10, 2019 01:34
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 olehi94/04030f2a3797d49bf68cb3e425d5c72f to your computer and use it in GitHub Desktop.
Save olehi94/04030f2a3797d49bf68cb3e425d5c72f to your computer and use it in GitHub Desktop.
Complete example module_name.info.yml

dependencies - A list of other modules your module depends on. Dependencies should be namespaced in the format {project}:{module}, where {project} is the project name as it appears in the Drupal.org URL (e.g. drupal.org/project/views) and {module} is the module's machine name. Dependencies can also include version restrictions, for examplewebform:webform (>=8.x-5.x). Note that if your module has dependencies on other contributed modules or libraries, these should be declared in the module's composer.json file.

test_dependencies - A list of other modules (in the same format as dependencies) that are needed to run certain automated tests for your module on Drupal's automated test runner ("DrupalCI"), but not needed as module dependencies in general (or that are in development as module dependencies but not finalized yet). Note that you need to have the test_dependencies change committed to your Git repository before you try to run a test that depends on it -- you cannot just put the info.yml changeinto the same patch as the new test. As an alternative, you can also use Composer for test dependences -- see https://www.drupal.org/docs/develop/using-composer/managing-dependencies... for more information.

configure - If your module offers a configuration form, then you can specify the route to this form here. It will then show up as a link in the Extend page (/admin/modules) when the user expands the details.

php: 5.6 - Defines the minimal PHP version that is required for you module. Users will not be able to enable the module if they use an older PHP version. This can be used to avoid errors if your module uses newer functions that did not exists in earlier PHP versions.

hidden: true - This will hide your module from the module list on the Extend page (/admin/modules). You might find it useful to hide a module if it only contains tests, or is intended to serve as an example for developers who need to implement the main module's API. You can make these modules visible by adding $settings['extension_discovery_scan_tests'] = TRUE to your settings.php.

name: Hello World Module
description: Creates a page showing "Hello World".
package: Custom
type: module
core: 8.x
dependencies:
- drupal:link
- drupal:views
- paragraphs:paragraphs
install:
- views_ui
- field_ui
- contextual
test_dependencies:
- drupal:image
configure: hello_world.settings
php: 5.6
hidden: true
# Note: do not add the 'version' property yourself!
# It will be added automatically by the packager on drupal.org.
version: 1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment