Fixed
Project:
Display Builder
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Nov 2026 at 15:06 UTC
Updated:
18 Nov 2026 at 18:36 UTC
Jump to comment: Most recent
Comments
Comment #2
mogtofu33 commentedComment #3
juc1 commentedComment #5
juc1 commentedMR with the help of Antigravity AI:
### Summary
When uninstalling a theme or module, Drupal recalculates configuration dependencies on dependent entities. If a Page Layout contains a source plugin that no longer exists or cannot be built, `PageLayout::calculateDependencies()` attempts to instantiate it without error handling. This triggers an unhandled `PluginNotFoundException` and causes the theme uninstallation process to crash with a fatal error.
This can be resolved by wrapping the source plugin instantiation in `PageLayout::calculateDependencies()` in a defensive `try / catch (\Exception $e)` block—mirroring the pattern already used in `SourceTree::onDependencyRemoval()`. If a source cannot be instantiated, a warning is logged to the `display_builder_page_layout` logger channel and that source is skipped, allowing dependency recalculation and extension uninstallation to finish cleanly.
### Technical Details & Files Changed
- **`modules/display_builder_page_layout/src/Entity/PageLayout.php`**:
- Wrapped `$this->sourceManager()->getSource()` in a `try/catch` block.
- Added an `instanceof SourceInterface` check.
- Added a warning log via `\Drupal::logger('display_builder_page_layout')` recording the offending node ID and error message.
- **`modules/display_builder_page_layout/tests/src/Kernel/PageLayoutConfigDependenciesTest.php`**:
- Added `testUnknownSourceDoesNotAbortThemeUninstall()` to reproduce the issue and verify both the graceful handling in `calculateDependencies()` and successful theme uninstallation.
- Asserted warning log presence using `ColinODell\PsrTestLogger\TestLogger`.
### Testing & Quality Assurance
- Automated tests pass (74 kernel tests, 831 assertions).
- PHPCS passes with 0 errors and 0 warnings.
- PHPStan passes with 0 errors.
Comment #6
juc1 commentedComment #8
mogtofu33 commentedThanks for the fix, a possible follow-up: an unknown source nested inside a component skips that whole root's dependencies.