Skip to content

[module:dependency:install] Install current module dependecy  #2083

@itsdarrylnorris

Description

@itsdarrylnorris

Problem / Motivation

Current in order for someone to enable a module programmatically in Drupal 8. They either need to write a hook_update to programmatically enable the module like this...

/**
 * Implements hook_update.
 */
  function BestUpdateever_update_7000() {
  module_enable(array('mymodule'));
}

Or write a chain command that will enable the module similar to this ...

  - command: module:install
    options:
        learning: true
    arguments:
        module:
            - ld

Any of these methods generates a lot of unnecessary code. Instead, what we should be doing is having a module that is already installed added as a dependency in their .info file.The user is going to use module:dependency:install command to find if there are any dependency for that module on their deployment script.. If there is going to install all modules that are not enabled.

This will decrease the amount code because the end results should be scripts that always check if there are any dependency available and adding that dependency to your installed module.

Solution

  • Create a module that allows you to look for any uninstall dependency in your installed module and install them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions