. */ declare(strict_types=1); namespace App\Settings\SystemSettings; use App\Form\Type\DataSourceSynonymsCollectionType; use App\Services\ElementTypes; use App\Settings\SettingsIcon; use Jbtronics\SettingsBundle\ParameterTypes\ArrayType; use Jbtronics\SettingsBundle\ParameterTypes\SerializeType; use Jbtronics\SettingsBundle\ParameterTypes\StringType; use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Symfony\Component\Translation\TranslatableMessage as TM; use Symfony\Component\Validator\Constraints as Assert; #[Settings(label: new TM("settings.system.data_source_synonyms"))] #[SettingsIcon("fa-language")] class DataSourceSynonymsSettings { use SettingsTrait; #[SettingsParameter( ArrayType::class, label: new TM("settings.system.data_source_synonyms.configuration"), description: new TM("settings.system.data_source_synonyms.configuration.help"), options: ['type' => SerializeType::class], formType: DataSourceSynonymsCollectionType::class, formOptions: [ 'required' => false, 'data_sources' => [ 'category' => new TM("settings.behavior.data_source_synonyms.category"), 'storagelocation' => new TM("settings.behavior.data_source_synonyms.storagelocation"), 'footprint' => new TM("settings.behavior.data_source_synonyms.footprint"), 'manufacturer' => new TM("settings.behavior.data_source_synonyms.manufacturer"), 'supplier' => new TM("settings.behavior.data_source_synonyms.supplier"), 'project' => new TM("settings.behavior.data_source_synonyms.project"), ], ], )] #[Assert\Type('array')] #[Assert\All([new Assert\Type('array')])] /** * @var array> $customTypeLabels * An array of the form: [ * 'category' => [ * 'en' => ['singular' => 'Category', 'plural' => 'Categories'], * 'de' => ['singular' => 'Kategorie', 'plural' => 'Kategorien'], * ], * 'manufacturer' => [ * 'en' => ['singular' => 'Manufacturer', 'plural' =>'Manufacturers'], * ], * ] */ public array $customTypeLabels = []; public function isCustomLabelDefinedForType(ElementTypes $type): bool { return isset($this->customTypeLabels[$type->value]); } }