Score:0

Why would a contributed module try to load one of its files from a custom directory?

ma flag

I built a module on a local instance in my module/custom directory; I then published it on drupal.org, as Group by Field Widget. For some reason, when I install the release 1.1.1 via Composer, I get this error.

Warning: include(/app/web/modules/custom/group_by_field_widget/src/Plugin/Field/FieldWidget/EntityReferenceGroupByFieldWidget.php): failed to open stream: No such file or directory in /app/vendor/composer/ClassLoader.php on line 444
Warning: include(): Failed opening '/app/web/modules/custom/group_by_field_widget/src/Plugin/Field/FieldWidget/EntityReferenceGroupByFieldWidget.php' for inclusion (include_path='/app/vendor/pear/pear_exception:/app/vendor/pear/console_getopt:/app/vendor/pear/pear-core-minimal/src:/app/vendor/pear/archive_tar:.:/usr/local/lib/php') in /app/vendor/composer/ClassLoader.php on line 444
Drupal\Component\Plugin\Exception\PluginException: Plugin (entity_reference_group_by_field_widget) instance class "Drupal\group_by_field_widget\Plugin\Field\FieldWidget\EntityReferenceGroupByFieldWidget" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

The module is installed in the module/contrib directory via Composer, but the warning states that /app/vendor/composer/ClassLoader.php is loading files from /app/web/modules/custom/.

Please note the error only appears when editing the manage form display page.

When I move the module into the custom directory it works fine. What would tie a module to a directory?

J.Floyd avatar
ma flag
This was resolved but no solution has been found. I renamed my widget from EntityReferenceGroupByFieldWidget to GroupByFieldReferenceWidget and like magic it started working. Still looking for reason the original version didn't work. Could it be a core restriction on how widgets are named?
cn flag
Yeah, I just installed your module and I couldn't reproduce the error. It could be that your `composer.json` on the test site was messed up somehow. In the future, it is much easier to debug problems if you post the actual code (the `composer.json` that you used to install the module) and the version of the module that is not working.
J.Floyd avatar
ma flag
@PatrickKenny did you install the 1.1.2 version because that is the version with the change and it does work as expected. version 1.1.1 is the broken release.
J.Floyd avatar
ma flag
@PatrickKenny Also the error only appears when you visit the manage form display page.
cn flag
I installed 1.1.2 because how am I supposed to know what version to install if you don't say? And how am I supposed to know how to reproduce the error if you don't describe how to do so in the question?
J.Floyd avatar
ma flag
@PatrickKenny My apologies, I was working the problem after I posted the question. I had literally just release the fix that resolved this when you downloaded it. You are correct, I should have provided better details.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.