Renamed all files to Synonyms

This commit is contained in:
Jan Böhmer 2025-11-11 23:44:06 +01:00
parent 446f4a662d
commit 1234f447fd
9 changed files with 79 additions and 29 deletions

View file

@ -21,12 +21,11 @@
declare(strict_types=1);
namespace App\Form\Type;
namespace App\Form\Settings;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\LanguageType;
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
use Symfony\Component\Intl\Languages;
use Symfony\Component\OptionsResolver\OptionsResolver;

View file

@ -20,28 +20,26 @@
declare(strict_types=1);
namespace App\Form\Type;
namespace App\Form\Settings;
use App\Services\ElementTypes;
use App\Settings\SystemSettings\LocalizationSettings;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Intl\Locales;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints as Assert;
/**
* A single translation row: data source + language + translations (singular/plural).
*/
class DataSourceSynonymRowType extends AbstractType
class TypeSynonymRowType extends AbstractType
{
private const PREFFERED_TYPES = [
private const PREFERRED_TYPES = [
ElementTypes::CATEGORY,
ElementTypes::STORAGE_LOCATION,
ElementTypes::FOOTPRINT,
@ -62,14 +60,13 @@ class DataSourceSynonymRowType extends AbstractType
->add('dataSource', EnumType::class, [
'class' => ElementTypes::class,
'label' => false,
//'choices' => $this->buildDataSourceChoices($options['data_sources']),
'required' => true,
'constraints' => [
new Assert\NotBlank(),
],
'row_attr' => ['class' => 'mb-0'],
'attr' => ['class' => 'form-select-sm'],
'preferred_choices' => self::PREFFERED_TYPES
'preferred_choices' => self::PREFERRED_TYPES
])
->add('locale', LocaleType::class, [
'label' => false,

View file

@ -1,8 +1,26 @@
<?php
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace App\Form\Type;
namespace App\Form\Settings;
use App\Services\ElementTypes;
use Symfony\Component\Form\AbstractType;
@ -21,7 +39,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
* View data: list [{dataSource, locale, translation_singular, translation_plural}, ...]
* Model data: same structure (list). Optionally expands a nested map to a list.
*/
class DataSourceSynonymsCollectionType extends AbstractType
class TypeSynonymsCollectionType extends AbstractType
{
public function __construct(private readonly TranslatorInterface $translator)
{
@ -180,7 +198,7 @@ class DataSourceSynonymsCollectionType extends AbstractType
// Defaults for the collection and entry type
$resolver->setDefaults([
'entry_type' => DataSourceSynonymRowType::class,
'entry_type' => TypeSynonymRowType::class,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
@ -198,6 +216,6 @@ class DataSourceSynonymsCollectionType extends AbstractType
public function getBlockPrefix(): string
{
return 'datasource_synonyms_collection';
return 'type_synonyms_collection';
}
}

View file

@ -22,7 +22,7 @@ declare(strict_types=1);
namespace App\Settings;
use App\Form\Type\DataSourceSynonymsCollectionType;
use App\Form\Settings\TypeSynonymsCollectionType;
use App\Services\ElementTypes;
use Jbtronics\SettingsBundle\ParameterTypes\ArrayType;
use Jbtronics\SettingsBundle\ParameterTypes\SerializeType;
@ -43,7 +43,7 @@ class SynonymSettings
label: new TM("settings.system.synonyms.type_synonyms"),
description: new TM("settings.system.synonyms.type_synonyms.help"),
options: ['type' => SerializeType::class],
formType: DataSourceSynonymsCollectionType::class,
formType: TypeSynonymsCollectionType::class,
formOptions: [
'required' => false,
],

View file

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace App\Settings\SystemSettings;
use App\Form\Type\LanguageMenuEntriesType;
use App\Form\Settings\LanguageMenuEntriesType;
use App\Form\Type\LocaleSelectType;
use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;