Problem/Motivation
We recently updated our Components module to the latest version and faced an issue with the GraphQL Twig module. In the Components module the way how you define the location of components has changed from the key component-libraries to the key components. The change was done in the following issue: https://www.drupal.org/project/components/issues/3091762
However GraphQL Twig module also looks for the key components from the active theme's info file, leading to a conflict. For example if you have defined custom namespaces for your components you would see the following warning as we are not providing a string/path to the check performed in GraphQL Twig.
Warning: is_dir() expects parameter 1 to be a valid path, array given in Drupal\graphql_twig\Template\Loader\Loader->findTemplate() (line 129 of modules/contrib/graphql_twig/src/Template/Loader/Loader.php).
Steps to reproduce
1. Update to/use the latest version of the Components module
2. Define component namespaces according to the new way in your theme's info file: https://www.drupal.org/project/components/issues/3091762
3. You will see the warning reported above when browsing the frontend
Proposed resolution
For now let's add a check for if we are actually including components with a hash in the component name (which you can do when using Fractal components) in the Drupal templates before scanning all the templates in the components folder. We can also add a check for if the parameter used in is_dir() is a string to avoid the parameter warning, but in reality if you are using Fractal components and the latest version of the Components module you will have issues anyway since the "components" definition is in conflict with each other.
Issue fork graphql_twig-3197486
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 #3
gaards commentedComment #4
martijn de witEncountered the same problem. The patch from the merge request is working great.
Comment #5
martijn de witComment #7
saschaeggiThanks!