diff --git a/packages/guides/resources/config/guides.php b/packages/guides/resources/config/guides.php index a69251838..e2f4fae0d 100644 --- a/packages/guides/resources/config/guides.php +++ b/packages/guides/resources/config/guides.php @@ -57,6 +57,7 @@ use phpDocumentor\Guides\Twig\EnvironmentBuilder; use phpDocumentor\Guides\Twig\GlobalMenuExtension; use phpDocumentor\Guides\Twig\Theme\ThemeManager; +use phpDocumentor\Guides\Twig\TrimFilesystemLoader; use phpDocumentor\Guides\Twig\TwigTemplateRenderer; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Reference; @@ -223,11 +224,12 @@ param('phpdoc.guides.base_template_paths'), ) - ->set(FilesystemLoader::class) + ->set(TrimFilesystemLoader::class) ->arg( '$paths', param('phpdoc.guides.base_template_paths'), ) + ->alias(FilesystemLoader::class, TrimFilesystemLoader::class) ->set(LoadSettingsFromComposer::class) ->tag('event_listener', ['event' => PostProjectNodeCreated::class]) diff --git a/packages/guides/src/Twig/TrimFilesystemLoader.php b/packages/guides/src/Twig/TrimFilesystemLoader.php new file mode 100644 index 000000000..f0e93b1ed --- /dev/null +++ b/packages/guides/src/Twig/TrimFilesystemLoader.php @@ -0,0 +1,41 @@ +getCode()) ?? $source->getCode(), + $source->getName(), + $source->getPath(), + ); + } +}