From a8cac92bd4257f32a4e09c5a946bb67ebed85d83 Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Mon, 8 Jul 2019 10:58:20 +0200 Subject: [PATCH] Quote pagepart --- .../entities/pageparts/QuotePagePart.php | 63 +++++++++++++++++++ .../pageparts/QuotePagePartAdminType.php | 32 ++++++++++ .../PageParts/QuotePagePart/view.html.twig | 4 ++ 3 files changed, 99 insertions(+) create mode 100644 src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/entities/pageparts/QuotePagePart.php create mode 100644 src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/forms/pageparts/QuotePagePartAdminType.php create mode 100644 src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/templates/PageParts/QuotePagePart/view.html.twig diff --git a/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/entities/pageparts/QuotePagePart.php b/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/entities/pageparts/QuotePagePart.php new file mode 100644 index 0000000000..16bcf4b8b5 --- /dev/null +++ b/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/entities/pageparts/QuotePagePart.php @@ -0,0 +1,63 @@ +title = $title; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setText(?string $text): self + { + $this->text = $text; + + return $this; + } + + public function getText(): ?string + { + return $this->text; + } + + public function getDefaultView(): string + { + return 'pageparts/quote_pagepart/view.html.twig'; + } + + public function getDefaultAdminType(): string + { + return {{ admin_type_class }}::class; + } + +} diff --git a/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/forms/pageparts/QuotePagePartAdminType.php b/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/forms/pageparts/QuotePagePartAdminType.php new file mode 100644 index 0000000000..e4a3f03c5f --- /dev/null +++ b/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/forms/pageparts/QuotePagePartAdminType.php @@ -0,0 +1,32 @@ +add('title', TextType::class, [ + 'required' => true, + ]) + ->add('text', WysiwygType::class, [ + 'required' => true, + ]) + ; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => {{ pagepart_class }}::class, + ]); + } +} diff --git a/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/templates/PageParts/QuotePagePart/view.html.twig b/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/templates/PageParts/QuotePagePart/view.html.twig new file mode 100644 index 0000000000..3b49ec30fb --- /dev/null +++ b/src/Kunstmaan/GeneratorBundle/Resources/skeleton/default-pageparts/templates/PageParts/QuotePagePart/view.html.twig @@ -0,0 +1,4 @@ +
+

{{ resource.title }}

+ {{ resource.text|replace_url|raw }} +
\ No newline at end of file