Skip to content

Commit

Permalink
Form & Translation Bug Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cesurapp committed May 9, 2020
1 parent 3932f0a commit a359428
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
13 changes: 4 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
###> PhpUnit ###
###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< PhpUnit ###
###< symfony/phpunit-bridge ###

###> Symfony ###
/.env.local
Expand All @@ -27,10 +28,4 @@ src/*/Entity/*/*~
node_modules
.idea
/build/
.DS_Store

###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
.DS_Store
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions src/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ private function createUserFilterForm(): FormInterface
->add('status', ChoiceType::class, [
'label' => 'account_status',
'choices' => [
'select_all' => null,
'deactive' => '0',
'active' => '1',
'deactive' => '1',
'active' => '0',
],
'placeholder' => 'select_all',
'required' => false
])
->getForm();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Config/ConfigAbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function finishView(FormView $view, FormInterface $form, array $options)
// Create File Type File Path
foreach ($form->all() as $key => $formInterface) {
if ('file' === $formInterface->getConfig()->getType()->getBlockPrefix()) {
if (\is_array($formInterface->getViewData())) {
$view->children[$key]->vars['file_path'] = $formInterface->getViewData();
if ($formInterface->getViewData()) {
$view->children[$key]->vars['file_path'] = !is_array($formInterface->getViewData()) ? [$formInterface->getViewData()] : $formInterface->getViewData();
} elseif (!$formInterface->getViewData() && isset($options['data'][$key])) {
$view->children[$key]->vars['file_path'] = $options['data'][$key];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Config/GeneralForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
]),
new Image([
'mimeTypes' => [
'image/x-icon', 'image/png',
'image/x-icon', 'image/vnd.microsoft.icon', 'image/png',
],
]),
],
Expand Down
6 changes: 5 additions & 1 deletion src/Service/ConfigBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ public function saveToDB(ObjectManager $em, $configs): void
// Update
foreach ($data as $item) {
if (\array_key_exists($item->getName(), $configs)) {
$item->setValue($configs[$item->getName()]);
if (is_bool($configs[$item->getName()])) {
$item->setValue($configs[$item->getName()] ? 'true' : 'false');
} else {
$item->setValue($configs[$item->getName()]);
}
$em->persist($item);

unset($configs[$item->getName()]);
Expand Down
1 change: 1 addition & 0 deletions translations/messages.tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ changes_saved: Değişiklikler kaydedildi.
remove_complete: Silme işlemi tamamlandı.
sorry_not_existing: Üzgünüz kayıt mevcut değil.
test_email_success: Test e-postası gönderildi.
user_registration_disable: Kullanıcı kaydı şu anda kapalı, lütfen daha sonra tekrar deneyin.
440_not_found: Sayfa Bulunamadı!
440_not_found_description: Üzgünüz aradığınız sayfa bulunamadı veya kullanımdan kaldırılmış olabilir.

Expand Down

0 comments on commit a359428

Please sign in to comment.