From a8781de51a35f3f7fea7ad9c47dc996b9ca0a364 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Mon, 17 Sep 2018 13:15:36 +0200 Subject: [PATCH] Implemented form templates --- application/src/Form/NameSourceType.php | 4 ++-- application/templates/source/form/content/name.html.twig | 3 +++ application/templates/source/form/name.html.twig | 5 +++++ application/templates/source/form/source.html.twig | 6 ++++++ 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 application/templates/source/form/content/name.html.twig create mode 100644 application/templates/source/form/name.html.twig create mode 100644 application/templates/source/form/source.html.twig diff --git a/application/src/Form/NameSourceType.php b/application/src/Form/NameSourceType.php index 564b25c..14c0a71 100644 --- a/application/src/Form/NameSourceType.php +++ b/application/src/Form/NameSourceType.php @@ -2,11 +2,11 @@ namespace App\Form; -use App\Entity\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\Type\TextType; +use App\Entity\NameSource; class NameSourceType extends AbstractType { @@ -18,7 +18,7 @@ class NameSourceType extends AbstractType public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - 'data_class' => User::class, + 'data_class' => NameSource::class, ]); } } diff --git a/application/templates/source/form/content/name.html.twig b/application/templates/source/form/content/name.html.twig new file mode 100644 index 0000000..97a2252 --- /dev/null +++ b/application/templates/source/form/content/name.html.twig @@ -0,0 +1,3 @@ +{{ form_start(form) }} +{{ form_widget(form) }} +{{ form_end(form) }} \ No newline at end of file diff --git a/application/templates/source/form/name.html.twig b/application/templates/source/form/name.html.twig new file mode 100644 index 0000000..1c99a0d --- /dev/null +++ b/application/templates/source/form/name.html.twig @@ -0,0 +1,5 @@ +{% extends "source/form/source.html.twig" %} +{% block content %} +

{% trans %} Name {% endtrans %}

+{% include "source/form/content/name." ~ app.request.requestFormat ~ ".twig" %} +{% endblock %} diff --git a/application/templates/source/form/source.html.twig b/application/templates/source/form/source.html.twig new file mode 100644 index 0000000..58eb82d --- /dev/null +++ b/application/templates/source/form/source.html.twig @@ -0,0 +1,6 @@ +{% extends "frames/default.html.twig" %} +{% block title %} + {% trans %} + Source + {% endtrans %} +{% endblock %} \ No newline at end of file