Skip to content

Commit

Permalink
Exposed Focus Mode status in adminUI config (#1066)
Browse files Browse the repository at this point in the history
* Exposed Focus Mode status in adminUI config

* Update src/lib/UI/Config/Provider/FocusMode.php

Co-authored-by: Konrad Oboza <[email protected]>

---------

Co-authored-by: Konrad Oboza <[email protected]>
  • Loading branch information
ViniTou and konradoboza authored Dec 18, 2023
1 parent 35a4dff commit 9f2866f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bundle/Resources/config/services/ui_config/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ services:
tags:
- { name: ibexa.admin_ui.config.provider, key: 'autosave' }

Ibexa\AdminUi\UI\Config\Provider\FocusMode:
tags:
- { name: ibexa.admin_ui.config.provider, key: 'focusMode' }

Ibexa\Bundle\AdminUi\Templating\Twig\PathStringExtension: ~

Ibexa\Bundle\AdminUi\Templating\Twig\ContentTypeIconExtension: ~
Expand Down
29 changes: 29 additions & 0 deletions src/lib/UI/Config/Provider/FocusMode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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\AdminUi\Specification\UserMode\IsFocusModeEnabled;
use Ibexa\AdminUi\UserSetting\FocusMode as FocusModeSetting;
use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface;
use Ibexa\User\UserSetting\UserSettingService;

final class FocusMode implements ProviderInterface
{
private UserSettingService $userSettingService;

public function __construct(UserSettingService $userSettingService)
{
$this->userSettingService = $userSettingService;
}

public function getConfig(): bool
{
return IsFocusModeEnabled::fromUserSettings($this->userSettingService)->isSatisfiedBy(FocusModeSetting::FOCUS_MODE_ON);
}
}

0 comments on commit 9f2866f

Please sign in to comment.