Problem/Motivation

Right now, the example module is visible in the 'Extend' list.
This is not desired in my opinion, site builders should not be able to enable this module.

Proposed resolution

Let's add hidden: true to the .info.yml file of the example module.
I'll attach a patch in #2 for 4.x.

CommentFileSizeAuthor
#2 3309648-2.patch488 bytesrandalv
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

RandalV created an issue. See original summary.

randalv’s picture

Status: Active » Needs review
StatusFileSize
new488 bytes
rodrigoaguilera’s picture

I don't agree with the solution for this. Many popular modules provide discoverable examples modules like schema.org, webform and entity browser.
It is clearly stated that they are examples and I don't think many site builders can get confused by seeing it available for install.

Do you have examples of modules that do hide their example modules? So far I only found the geolocation module.

randalv’s picture

Hi @rodrigoaguilera,

There certainly are other modules that do this, per my request VBO has also changed this.
https://www.drupal.org/project/views_bulk_operations/issues/3309650

I don’t see any reason whatsoever for these modules to be discoverable, site builders don’t need to know about these modules and developers will much quicker find them by exploring the code or documentation than by scrolling through the modules UI page.

If the example module added something in the UI or anything useful to sitebuilders this would be a different story, but in the case of Hook Event Dispatcher where everything is entirely aimed at developers… no :-)

RenatoG made their first commit to this issue’s fork.

renatog’s picture

Status: Needs review » Reviewed & tested by the community

I agree with examples to be hidden. +1 to it

It is clearly stated that they are examples and I don't think many site builders can get confused by seeing it available for install

I agree that the editor might not be confused because is clear that is example, but I think isn't necessary to them to appear there. I think we can keep this list clean

We should ask the opposite; do you have any reason to display it in the extend list for CMS editors?

With patch #2 the example will be hidden on extend list in the UI only, and it’s clear that these examples are intended for developers, who can enable that though drush en command

So I think this is definitely acceptable

BTW I know that exists other modules that currently aren't hidden, but it don't means that this is correct way. We need to evaluate case by case and maybe suggest it for them if necessary.

On this case for hook_event_dispatcher specifically I'm with @randalv and I think makes sense. #RTBC

renatog’s picture

Created the MR https://git.drupalcode.org/project/hook_event_dispatcher/-/merge_request... with the same solution of patch #2 just to be easier to be merged though the UI if necessary

el7cosmos’s picture

Status: Reviewed & tested by the community » Fixed

this is good, hidden module can be shown again in admin UI with $settings['extension_discovery_scan_tests'] = TRUE in settings.php

  • el7cosmos committed c4c435a2 on 4.x authored by RenatoG
    Issue #3309648 by RenatoG, RandalV: Make sure 'example'-submodules are...

  • el7cosmos committed 5f2a243c on 3.x authored by RenatoG
    Issue #3309648 by RenatoG, RandalV: Make sure 'example'-submodules are...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

renatog’s picture

this is good, hidden module can be shown again in admin UI with $settings['extension_discovery_scan_tests'] = TRUE in settings.php

Good catch, thanks