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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3309648-2.patch | 488 bytes | randalv |
Issue fork hook_event_dispatcher-3309648
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
Comment #2
randalv commentedComment #3
rodrigoaguileraI 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.
Comment #4
randalv commentedHi @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 :-)
Comment #6
renatog commentedI agree with examples to be hidden. +1 to it
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 encommandSo 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_dispatcherspecifically I'm with @randalv and I think makes sense. #RTBCComment #8
renatog commentedCreated 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
Comment #9
el7cosmosthis is good, hidden module can be shown again in admin UI with
$settings['extension_discovery_scan_tests'] = TRUEin settings.phpComment #13
renatog commentedGood catch, thanks