diff --git a/src/Form/Part/EDAPartInfoType.php b/src/Form/Part/EDAPartInfoType.php index af4732f2..6b3ceea8 100644 --- a/src/Form/Part/EDAPartInfoType.php +++ b/src/Form/Part/EDAPartInfoType.php @@ -31,20 +31,59 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use function Symfony\Component\Translation\t; + class EDAPartInfoType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('reference_prefix', TextType::class) - ->add('value', TextType::class) - ->add('invisible', TriStateCheckboxType::class) - ->add('exclude_from_bom', TriStateCheckboxType::class) - ->add('exclude_from_board', TriStateCheckboxType::class) - ->add('exclude_from_sim', TriStateCheckboxType::class) - ->add('kicad_symbol', TextType::class) - ->add('kicad_footprint', TextType::class) - ; + ->add('reference_prefix', TextType::class, [ + 'label' => 'eda_info.reference_prefix', + 'attr' => [ + 'placeholder' => t('eda_info.reference_prefix.placeholder'), + ] + ] + ) + ->add('value', TextType::class, [ + 'label' => 'eda_info.value', + 'attr' => [ + 'placeholder' => t('eda_info.value.placeholder'), + ] + ]) + ->add('invisible', TriStateCheckboxType::class, [ + 'label' => 'eda_info.invisible', + ]) + ->add('exclude_from_bom', TriStateCheckboxType::class, [ + 'label' => 'eda_info.exclude_from_bom', + 'label_attr' => [ + 'class' => 'checkbox-inline' + ] + ]) + ->add('exclude_from_board', TriStateCheckboxType::class, [ + 'label' => 'eda_info.exclude_from_board', + 'label_attr' => [ + 'class' => 'checkbox-inline' + ] + ]) + ->add('exclude_from_sim', TriStateCheckboxType::class, [ + 'label' => 'eda_info.exclude_from_sim', + 'label_attr' => [ + 'class' => 'checkbox-inline' + ] + ]) + ->add('kicad_symbol', TextType::class, [ + 'label' => 'eda_info.kicad_symbol', + 'attr' => [ + 'placeholder' => t('eda_info.kicad_symbol.placeholder'), + ] + ]) + ->add('kicad_footprint', TextType::class, [ + 'label' => 'eda_info.kicad_footprint', + 'attr' => [ + 'placeholder' => t('eda_info.kicad_footprint.placeholder'), + ] + ]); } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Services/EDAIntegration/KiCADHelper.php b/src/Services/EDAIntegration/KiCADHelper.php index a4a3bd25..5e8d21a6 100644 --- a/src/Services/EDAIntegration/KiCADHelper.php +++ b/src/Services/EDAIntegration/KiCADHelper.php @@ -130,7 +130,7 @@ class KiCADHelper "symbolIdStr" => $part->getEdaInfo()->getKicadSymbol() ?? $part->getCategory()?->getEdaInfo()->getKicadSymbol() ?? "", "exclude_from_bom" => $this->boolToKicadBool($part->getEdaInfo()->getExcludeFromBom() ?? $part->getCategory()?->getEdaInfo()->getExcludeFromBom() ?? false), "exclude_from_board" => $this->boolToKicadBool($part->getEdaInfo()->getExcludeFromBoard() ?? $part->getCategory()?->getEdaInfo()->getExcludeFromBoard() ?? false), - "exclude_from_sim" => $this->boolToKicadBool($part->getEdaInfo()->getExcludeFromSim() ?? $part->getCategory()?->getEdaInfo()->getExcludeFromSim() ?? false), + "exclude_from_sim" => $this->boolToKicadBool($part->getEdaInfo()->getExcludeFromSim() ?? $part->getCategory()?->getEdaInfo()->getExcludeFromSim() ?? true), "fields" => [] ]; diff --git a/templates/parts/edit/_eda.html.twig b/templates/parts/edit/_eda.html.twig new file mode 100644 index 00000000..c1cd3991 --- /dev/null +++ b/templates/parts/edit/_eda.html.twig @@ -0,0 +1,24 @@ +{{ form_row(form.eda_info.reference_prefix) }} +{{ form_row(form.eda_info.value) }} + +
+
+ {{ form_row(form.eda_info.invisible) }} +
+
+ +
+
+ {{ form_widget(form.eda_info.exclude_from_bom) }} + {{ form_widget(form.eda_info.exclude_from_board) }} + {{ form_widget(form.eda_info.exclude_from_sim) }} +
+
+ +
+
+
{% trans %}eda_info.kicad_section.title{% endtrans %}:
+
+
+{{ form_row(form.eda_info.kicad_symbol) }} +{{ form_row(form.eda_info.kicad_footprint) }} \ No newline at end of file diff --git a/templates/parts/edit/edit_part_info.html.twig b/templates/parts/edit/edit_part_info.html.twig index 4dae8949..20cddbd7 100644 --- a/templates/parts/edit/edit_part_info.html.twig +++ b/templates/parts/edit/edit_part_info.html.twig @@ -64,6 +64,12 @@ {% trans %}part.edit.tab.associations{% endtrans %} +