Skip to content

Commit

Permalink
Fixed settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
mxgross committed May 15, 2023
1 parent 524a9a4 commit f02bc35
Showing 1 changed file with 33 additions and 39 deletions.
72 changes: 33 additions & 39 deletions EventSubscriber/SystemConfigurationSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use App\Event\SystemConfigurationEvent;
use App\Form\Model\Configuration;
use App\Form\Model\SystemConfiguration as SystemConfigurationModel;
use App\Form\Model\SystemConfiguration;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
Expand All @@ -21,7 +21,7 @@

class SystemConfigurationSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
SystemConfigurationEvent::class => ['onSystemConfiguration', 100],
Expand All @@ -31,43 +31,37 @@ public static function getSubscribedEvents()
public function onSystemConfiguration(SystemConfigurationEvent $event): void
{
$event->addConfiguration(
(new SystemConfigurationModel())
->setSection('easy_backup_config')
->setConfiguration([
(new Configuration())
->setName('easy_backup.setting_mysqldump_command')
->setLabel('easy_backup.setting_mysqldump_command')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextType::class),
(new Configuration())
->setName('easy_backup.setting_mysql_restore_command')
->setLabel('easy_backup.setting_mysql_restore_command')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextType::class),
(new Configuration())
->setName('easy_backup.setting_backup_dir')
->setLabel('easy_backup.setting_backup_dir')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextType::class),
(new Configuration())
->setName('easy_backup.setting_paths_to_backup')
->setLabel('easy_backup.setting_paths_to_backup')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextareaType::class),
(new Configuration())
->setName('easy_backup.setting_backup_amount_max')
->setLabel('easy_backup.setting_backup_amount_max')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setConstraints([new NotNull(), new GreaterThanOrEqual(['value' => -1])])
->setType(IntegerType::class)
->setValue(-1)
->setOptions(['help' => 'help.easy_backup.setting_backup_amount_max']),
])
(new SystemConfiguration('easy_backup_config'))
->setConfiguration([
(new Configuration('easy_backup.setting_mysqldump_command'))
->setLabel('easy_backup.setting_mysqldump_command')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextType::class),
(new Configuration('easy_backup.setting_mysql_restore_command'))
->setLabel('easy_backup.setting_mysql_restore_command')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextType::class),
(new Configuration('easy_backup.setting_backup_dir'))
->setLabel('easy_backup.setting_backup_dir')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextType::class),
(new Configuration('easy_backup.setting_paths_to_backup'))
->setLabel('easy_backup.setting_paths_to_backup')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setType(TextareaType::class),
(new Configuration('easy_backup.setting_backup_amount_max'))
->setLabel('easy_backup.setting_backup_amount_max')
->setTranslationDomain('system-configuration')
->setRequired(false)
->setConstraints([new NotNull(), new GreaterThanOrEqual(['value' => -1])])
->setType(IntegerType::class)
->setValue(-1)
->setOptions(['help' => 'help.easy_backup.setting_backup_amount_max']),
])
);
}
}

0 comments on commit f02bc35

Please sign in to comment.