From de5078b8d1a6ed1302ebad0713b6a4fefbf54abe Mon Sep 17 00:00:00 2001 From: Lars Lauger Date: Tue, 20 Aug 2024 09:15:01 +0200 Subject: [PATCH] feat: Add ExtraProvider for Fusion rendering paths --- Classes/Scope/Extra/FusionPathProvider.php | 49 ++++++++++++++++++++++ Configuration/Settings.FeatureFlags.yaml | 5 +++ Configuration/Settings.Providers.yaml | 1 + README.md | 13 ++++++ 4 files changed, 68 insertions(+) create mode 100644 Classes/Scope/Extra/FusionPathProvider.php create mode 100644 Configuration/Settings.FeatureFlags.yaml diff --git a/Classes/Scope/Extra/FusionPathProvider.php b/Classes/Scope/Extra/FusionPathProvider.php new file mode 100644 index 0000000..4ea8afc --- /dev/null +++ b/Classes/Scope/Extra/FusionPathProvider.php @@ -0,0 +1,49 @@ +handleRenderingException())") + */ + public function beforeFusionExceptionHandling(JoinPointInterface $joinPoint): void + { + if (!$joinPoint->isMethodArgument('fusionPath')) { + return; + } + + $fusionPath = $joinPoint->getMethodArgument('fusionPath'); + if ($joinPoint->isMethodArgument('exception')) { + $exception = $joinPoint->getMethodArgument('exception'); + if ($exception instanceof FusionRuntimeException) { + $fusionPath = $exception->getFusionPath(); + } + } + + $this->fusionPaths[] = $fusionPath; + } + + public function getExtra(): array + { + if (empty($this->fusionPaths)) { + return []; + } + + return [ + 'fusionPaths' => array_values(array_unique($this->fusionPaths)), + ]; + } +} diff --git a/Configuration/Settings.FeatureFlags.yaml b/Configuration/Settings.FeatureFlags.yaml new file mode 100644 index 0000000..4cc0c9c --- /dev/null +++ b/Configuration/Settings.FeatureFlags.yaml @@ -0,0 +1,5 @@ +Netlogix: + Sentry: + featureFlags: + # Set to true when Neos.Fusion is installed + fusionFeatures: false diff --git a/Configuration/Settings.Providers.yaml b/Configuration/Settings.Providers.yaml index d718c38..fbfe62b 100644 --- a/Configuration/Settings.Providers.yaml +++ b/Configuration/Settings.Providers.yaml @@ -7,6 +7,7 @@ Netlogix: 'Netlogix\Sentry\Scope\Environment\FlowSettings': true extra: + 'Netlogix\Sentry\Scope\Extra\FusionPathProvider': true 'Netlogix\Sentry\Scope\Extra\ReferenceCodeProvider': true release: diff --git a/README.md b/README.md index a43cd8c..f2fd645 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,19 @@ Netlogix: You can also use the `Netlogix\Sentry\Scope\Release\FlowSettings` to set the Release through Flow Configuration (`Netlogix.Sentry.release.setting`, set to `%env:SENTRY_RELEASE%` by default). +## Feature Flags + +You can enable additional features that require other packages to be installed (e.g. Fusion Path collection) by +adjusting the settings below `Netlogix.Sentry.featureFlags`. Take a look at Configuration/Settings.FeatureFlags.yaml. + +```yaml +Netlogix: + Sentry: + featureFlags: + # Set to true when Neos.Fusion is installed + fusionFeatures: false +``` + ## Custom Providers For each scope, you can implement your own providers. Each scope requires it's own interface: