The module list call back is not working properly

  1. It doesn't filter the module list based on the entry
  2. If you put your module within a folder (i.e. : custom) the module name doesn't shows up, custom is

Patch is coming

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Kgaut’s picture

eme’s picture

Well, this is much better indeed, but we need :
- To have an autocompetion on non active module because we'll for sure create a module and some files, and the activate it.
- To exclude core module (we do not want to mess up with the core).
- If possible, change $_GET['q'] into an argument of the function like we did in Drupal 7.

eme’s picture

For core, it is quite easy as we can see the folder structure with core/xx

But for disabled module, it may be harsher and we may need to find the right method to parse de module folder and find all files to get the .info.yml.

Kgaut’s picture

Yep,

Will dig it.

but for this point :

If possible, change $_GET['q'] into an argument of the function like we did in Drupal 7.

It can't find a way to achieve that , there is a #autocomplete_route_parameters but it doesn't seem to apply to our case : https://www.drupal.org/node/2070985

Do you know how to configure the field to tell the way to use the autocomplete argument ?

Kgaut’s picture

Here's the patch returning only non core module, but only the activated. I'll look for a way to add non-activated too.

Kgaut’s picture

Just found a way with the function system_rebuild_module_data().

Patched attached fixing ;

  • Return only non core module (I can't think to a way to exclude contrib too)
  • Return also nn-installed modules
eme’s picture

That is a great job !

I think that we should keep contributed modules in the list. We could query the drupal.org API to know for it, but I will for sure develop some contributed module with generator UI.

Last thing is to avoid the $_GET parameters and we can achieve that with the Request object.

So we need to use Symfony\Component\HttpFoundation\Request and then we can get the query part by simply adding Request $request as argument in the autocomplete method and then calling $request->query->get('q');

And just after, we'll create an autocomplete generator !

Kgaut’s picture

Here's the version using the HTTPFoundation component