Problem/Motivation
To find a component's settings groups, CanvasBootstrapFormHooks::resolveComponentMetadataPath() asks the extension path resolver for the provider as a theme and then as a module, and catches InvalidArgumentException.
The resolver does not throw for an unknown extension: it raises an E_USER_WARNING, which Drupal logs. So every component settings form an editor opens logs a PHP warning: "The following theme is missing from the file system" for this module's own components, and "The following module is missing from the file system" for a theme's components. The log fills with warnings that hide real problems.
Steps to reproduce
- Install Canvas and Canvas Bootstrap, with Database Logging on.
- In Canvas, place a Canvas Bootstrap component and open its settings.
- Go to Reports > Recent log messages: there is a PHP warning "The following theme is missing from the file system: canvas_bootstrap".
Proposed resolution
Look the provider up only as the type of extension it is, by checking extension.list.theme / extension.list.module with exists() before asking for its path. The try/catch blocks are no longer needed.
The attached patch does this; it applies to 1.0.8 and the 1.0.x branch. It calls \Drupal::service() to keep the patch small; injecting the two extension lists would be cleaner in a merge request.
Remaining tasks
- Review.
- Merge request.
| Comment | File | Size | Author |
|---|---|---|---|
| canvas_bootstrap-no-missing-extension-warning.patch | 1.49 KB | alaa abbad |
Issue fork canvas_bootstrap-3634949
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
alaa abbad commentedMR uses the same approach as the patch, with the extension lists injected instead of \Drupal::service()
Comment #5
alaa abbad commentedMerged into 1.0.x. Thanks!
Comment #7
ahmad abbad commented