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

  1. Install Canvas and Canvas Bootstrap, with Database Logging on.
  2. In Canvas, place a Canvas Bootstrap component and open its settings.
  3. 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.
Command icon 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

alaa abbad created an issue. See original summary.

alaa abbad’s picture

Status: Active » Needs review

MR uses the same approach as the patch, with the extension lists injected instead of \Drupal::service()

  • alaa abbad committed 54a41e0d on 1.0.x
    fix: #3634949 Look a component's provider up only as its extension type...
alaa abbad’s picture

Status: Needs review » Fixed

Merged into 1.0.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

ahmad abbad’s picture

Status: Fixed » Closed (fixed)