From 6549fdb2d1a985fea0ebc4623c8658f25caf6938 Mon Sep 17 00:00:00 2001 From: konradoboza Date: Wed, 25 Oct 2023 14:40:29 +0200 Subject: [PATCH] IBX-6848: Added `OpenedBlockSettings` and `IsPageBuilderVisited` config providers --- .../config/services/ui_config/common.yaml | 8 +++++ .../Config/Provider/IsPageBuilderVisited.php | 34 +++++++++++++++++++ .../Config/Provider/OpenedBlockSettings.php | 33 ++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 src/lib/UI/Config/Provider/IsPageBuilderVisited.php create mode 100644 src/lib/UI/Config/Provider/OpenedBlockSettings.php diff --git a/src/bundle/Resources/config/services/ui_config/common.yaml b/src/bundle/Resources/config/services/ui_config/common.yaml index 8ba39dd7c1..53c2674d21 100644 --- a/src/bundle/Resources/config/services/ui_config/common.yaml +++ b/src/bundle/Resources/config/services/ui_config/common.yaml @@ -127,3 +127,11 @@ services: Ibexa\AdminUi\UI\Config\Provider\CurrentBackOfficePath: tags: - { name: ibexa.admin_ui.config.provider, key: 'backOfficePath' } + + Ibexa\AdminUi\UI\Config\Provider\OpenedBlockSettings: + tags: + - { name: ibexa.admin_ui.config.provider, key: 'openedBlockSettings' } + + Ibexa\AdminUi\UI\Config\Provider\IsPageBuilderVisited: + tags: + - { name: ibexa.admin_ui.config.provider, key: 'isPageBuilderVisited' } diff --git a/src/lib/UI/Config/Provider/IsPageBuilderVisited.php b/src/lib/UI/Config/Provider/IsPageBuilderVisited.php new file mode 100644 index 0000000000..d14418fb92 --- /dev/null +++ b/src/lib/UI/Config/Provider/IsPageBuilderVisited.php @@ -0,0 +1,34 @@ +userPreferenceService = $userPreferenceService; + } + + public function getConfig(): string + { + try { + return $this->userPreferenceService + ->getUserPreference('page_builder_visited') + ->value; + } catch (Exception $e) { + return 'false'; + } + } +} diff --git a/src/lib/UI/Config/Provider/OpenedBlockSettings.php b/src/lib/UI/Config/Provider/OpenedBlockSettings.php new file mode 100644 index 0000000000..a1b25a2bba --- /dev/null +++ b/src/lib/UI/Config/Provider/OpenedBlockSettings.php @@ -0,0 +1,33 @@ +userSettingService = $userSettingService; + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ + public function getConfig(): string + { + return $this->userSettingService + ->getUserSetting('block_settings') + ->value; + } +}