Within my custom module i've got an optional implementation to the dynamic entity reference module: https://www.drupal.org/project/dynamic_entity_reference

When the module exists, I add a DER field to one of my custom tables during the module installation.

The issue i am currently facing is that I can not manipulate the installation order of my module. Within the install hook of my module i am using module_set_weight("mymodule",1). However this is not effecting the installation order at all when I run drush config-import order or drush site-install --config-dir="/my/conf".

Within my core.extensions.yml the weight got applied after config export: drupal_content_sync: 1


For me this sounds pretty simple to solve. In your custom module just set a requirement:

name: Foo Bar
description: 'Lorem ipsum.'
package: Custom

type: module
core: '8.x'

  - dynamic_entity_reference:dynamic_entity_reference

By that you ensure that dynamic_entity_reference exists and is enabled when your module gets installed. That's it. Except I misunderstand you and you are instead looking for hook_module_implements_alter to change the order of modules calling a certain hook.

  • Sadly this is not the thing I want to achieve. dynamic_entity_reference should be a an optional dependency which must not be installed. But if it is installed, you can use some extra functionalities. – Sebastian Jul 9 '18 at 9:32
  • 1
    @Sebastian – Then I'd put this into a sub-module instead. Then the user has to decide. – leymannx Jul 9 '18 at 9:40
  • @Sebastian – Or you make this an option in your modules config page which only can be switched on, if your desired requirements are met. – leymannx Jul 9 '18 at 9:43
  • Good call, I am going with the submodule :) – Sebastian Jul 10 '18 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.