Skip to content

Commit

Permalink
IBX-6848: Added OpenedBlockSettings and IsPageBuilderVisited conf…
Browse files Browse the repository at this point in the history
…ig providers
  • Loading branch information
konradoboza committed Oct 25, 2023
1 parent 17f7e51 commit 6549fdb
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/bundle/Resources/config/services/ui_config/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
34 changes: 34 additions & 0 deletions src/lib/UI/Config/Provider/IsPageBuilderVisited.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\AdminUi\UI\Config\Provider;

use Exception;
use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface;
use Ibexa\Contracts\Core\Repository\UserPreferenceService;

final class IsPageBuilderVisited implements ProviderInterface
{
private UserPreferenceService $userPreferenceService;

public function __construct(UserPreferenceService $userPreferenceService)
{
$this->userPreferenceService = $userPreferenceService;
}

public function getConfig(): string
{
try {
return $this->userPreferenceService
->getUserPreference('page_builder_visited')
->value;
} catch (Exception $e) {
return 'false';
}
}
}
33 changes: 33 additions & 0 deletions src/lib/UI/Config/Provider/OpenedBlockSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\AdminUi\UI\Config\Provider;

use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface;
use Ibexa\User\UserSetting\UserSettingService;

final class OpenedBlockSettings implements ProviderInterface
{
private UserSettingService $userSettingService;

public function __construct(UserSettingService $userSettingService)
{
$this->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;
}
}

0 comments on commit 6549fdb

Please sign in to comment.