Google and stack has come up dry so far, so I'll ask you: In Drupal 8, does my module folder need to match the name of my module? Some basic testing indicates that they can differ with no harm done, but Drupal 8 is still a bit of a black-box to me and I don't want to find myself painted into a corner because of this.

  • 3
    If you are contributing it out, I would say, yes. If not, you don’t. But it will be easier to track over time with the more you create. I tend to namespace my modules with the project for internal use. – Kevin Oct 18 '18 at 19:13
  • 1
    Why do you need to have it named differently? – leymannx Oct 18 '18 at 19:29

Good conventions mentioned by Kevin aside, there's no technical reason for the names to match, no. What's important is the name of the .info.yml file, that's what defines the module machine name.

Drupal just interrogates the known module folder locations recursively looking for .info.yml files, so anything will get picked up regardless of folder name.

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.