Problem/Motivation

When a component provider is a theme (e.g., bootstrap_theme), the method CanvasBootstrapFormHooks::resolveComponentMetadataPath() attempts to call:

$this->pathResolver->getPath('module', $provider);

This generates:

User warning: The following module is missing from the file system: bootstrap_theme

followed by:

Deprecated function: dirname(): Passing null to parameter #1 ($path)

because getPath() returns null for missing extensions.

Steps to reproduce

Use a custom theme with sdc components and canvas_bootstrap togheter.

Proposed resolution

Check if provider is a theme or is a module before calling getPath():


$theme = \Drupal::service('theme_handler')->getTheme($provider);
if ($theme) {
  // Is a theme
}
elseif (\Drupal::service('module_handler')->moduleExists($provider)) {
  // Is a module
}

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Comments

maurizio.ganovelli created an issue. See original summary.

alaa abbad’s picture

Status: Active » Closed (duplicate)

Thanks for the report! This is fixed in #3634949, merged into 1.0.x: the provider is now looked up only as the type of extension it is, so neither the "missing from the file system" warning nor the dirname(null) deprecation happens. The fix will be in 1.0.10.

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.