-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...GeneratorBundle/Resources/skeleton/default-pageparts/entities/pageparts/QuotePagePart.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace {{ namespace }}\Entity\PageParts; | ||
|
||
use {{ admin_type_full }}; | ||
use Doctrine\ORM\Mapping as ORM; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
/** | ||
* @ORM\Table(name="{{ table_name }}") | ||
* @ORM\Entity | ||
*/ | ||
class QuotePagePart extends AbstractPagePart | ||
{ | ||
/** | ||
* @var string | ||
* @ORM\Column(name="title", type="string", length=255, nullable=true) | ||
* @Assert\NotBlank() | ||
*/ | ||
private $title; | ||
|
||
/** | ||
* @var string | ||
* @ORM\Column(name="text", type="text", nullable=true) | ||
* @Assert\NotBlank() | ||
*/ | ||
private $text; | ||
|
||
public function setTitle(?string $title): self | ||
{ | ||
$this->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; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...torBundle/Resources/skeleton/default-pageparts/forms/pageparts/QuotePagePartAdminType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace {{ namespace }}\Form\PageParts; | ||
|
||
use {{ pagepart_class_full }}; | ||
use Kunstmaan\AdminBundle\Form\WysiwygType; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class QuotePagePartAdminType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add('title', TextType::class, [ | ||
'required' => true, | ||
]) | ||
->add('text', WysiwygType::class, [ | ||
'required' => true, | ||
]) | ||
; | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver->setDefaults([ | ||
'data_class' => {{ pagepart_class }}::class, | ||
]); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...dle/Resources/skeleton/default-pageparts/templates/PageParts/QuotePagePart/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="quote-pp"> | ||
<p>{{ resource.title }}</p> | ||
{{ resource.text|replace_url|raw }} | ||
</div> |