Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

IBX-5143: Fixed autosave default value #2093

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/lib/UserSetting/Autosave.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace EzSystems\EzPlatformAdminUi\UserSetting;

use eZ\Publish\Core\Base\Exceptions\InvalidArgumentException;
use eZ\Publish\Core\MVC\ConfigResolverInterface;
use EzSystems\EzPlatformUser\UserSetting\FormMapperInterface;
use EzSystems\EzPlatformUser\UserSetting\ValueDefinitionInterface;
use JMS\TranslationBundle\Annotation\Desc;
Expand All @@ -24,10 +25,15 @@ class Autosave implements ValueDefinitionInterface, FormMapperInterface
/** @var \Symfony\Contracts\Translation\TranslatorInterface */
private $translator;

/** @var \eZ\Publish\Core\MVC\ConfigResolverInterface */
private $configResolver;

public function __construct(
TranslatorInterface $translator
TranslatorInterface $translator,
ConfigResolverInterface $configResolver
) {
$this->translator = $translator;
$this->configResolver = $configResolver;
}

public function getName(): string
Expand Down Expand Up @@ -57,7 +63,7 @@ public function getDisplayValue(string $storageValue): string

public function getDefaultValue(): string
{
return self::ENABLED_OPTION;
return $this->configResolver->getParameter('autosave.enabled') == false ? self::DISABLED_OPTION : self::ENABLED_OPTION;
}

public function mapFieldForm(
Expand Down