From 28de4669fe4b8a1a35f30261ec19341f7951240a Mon Sep 17 00:00:00 2001 From: Avior Date: Wed, 17 Apr 2019 21:16:00 +0200 Subject: [PATCH] Updated Inputs --- src/AdminPanel/Form/ChoiceInput.php | 5 +++++ src/AdminPanel/Form/DateInput.php | 5 +++++ src/AdminPanel/Form/TextInput.php | 9 ++++++++- src/AdminPanel/Twig/form/entity.twig | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/AdminPanel/Form/ChoiceInput.php b/src/AdminPanel/Form/ChoiceInput.php index ef3d551..121a1cb 100644 --- a/src/AdminPanel/Form/ChoiceInput.php +++ b/src/AdminPanel/Form/ChoiceInput.php @@ -12,4 +12,9 @@ class ChoiceInput extends TextInput 'choices' ); } + + public function getTemplate(): string + { + return "@AdminPanel/form/choice.twig"; + } } diff --git a/src/AdminPanel/Form/DateInput.php b/src/AdminPanel/Form/DateInput.php index 49e7b42..06edaed 100644 --- a/src/AdminPanel/Form/DateInput.php +++ b/src/AdminPanel/Form/DateInput.php @@ -11,4 +11,9 @@ class DateInput extends TextInput 'value', ); } + + public function getTemplate(): string + { + return "@AdminPanel/form/date.twig"; + } } diff --git a/src/AdminPanel/Form/TextInput.php b/src/AdminPanel/Form/TextInput.php index 25cd438..854458d 100644 --- a/src/AdminPanel/Form/TextInput.php +++ b/src/AdminPanel/Form/TextInput.php @@ -18,6 +18,13 @@ class TextInput implements Input public function getTemplate(): string { - return "@AdminPanel/form/text.twig"; + $tpName = strtolower( + str_replace( + "Input", + "", + str_split('\\', self::class)[1] + ) + ); + return "@AdminPanel/form/" . $tpName . ".twig"; } } diff --git a/src/AdminPanel/Twig/form/entity.twig b/src/AdminPanel/Twig/form/entity.twig index 77020d3..2a69a71 100644 --- a/src/AdminPanel/Twig/form/entity.twig +++ b/src/AdminPanel/Twig/form/entity.twig @@ -4,7 +4,7 @@ {% endif %} - + {% for entity in entities %}