Skip to content

Commit 3449e0f

Browse files
author
wladyslaw.dudko@gmail.com
committed
added option to set a template
1 parent 0fb9695 commit 3449e0f

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

src/Entity/Page/Page.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ class Page implements TranslatableInterface, BlameableInterface, TimestampableIn
8686
*/
8787
private $isSeparateContent = false;
8888

89+
/**
90+
* @var string|null
91+
* @ORM\Column(type="string", length=255, nullable=true)
92+
*/
93+
private ?string $template = null;
94+
8995
public function __construct()
9096
{
9197
$this->children = new ArrayCollection();
@@ -313,4 +319,20 @@ public function setRedirect(?string $redirect): void
313319
{
314320
$this->translate(null, false)->setRedirect($redirect);
315321
}
322+
323+
/**
324+
* @return string|null
325+
*/
326+
public function getTemplate(): ?string
327+
{
328+
return $this->template;
329+
}
330+
331+
/**
332+
* @param string|null $template
333+
*/
334+
public function setTemplate(?string $template): void
335+
{
336+
$this->template = $template;
337+
}
316338
}

src/Form/PageType.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace TwinElements\PageBundle\Form;
44

5-
use TwinElements\FormExtensions\Type\FileWithTitleType;
65
use TwinElements\FormExtensions\Type\ImageAlbumType;
76
use TwinElements\FormExtensions\Type\TEChooseLinkType;
87
use TwinElements\PageBundle\Entity\Page\Page;
@@ -16,7 +15,6 @@
1615
use TwinElements\Component\AdminTranslator\AdminTranslator;
1716
use TwinElements\FormExtensions\Type\AttachmentsType;
1817
use TwinElements\FormExtensions\Type\SaveButtonsType;
19-
use TwinElements\FormExtensions\Type\TECollectionType;
2018
use TwinElements\FormExtensions\Type\TEEntityType;
2119
use TwinElements\FormExtensions\Type\TEUploadType;
2220
use TwinElements\FormExtensions\Type\TinymceType;
@@ -112,10 +110,15 @@ public function buildForm(FormBuilderInterface $builder, array $options)
112110
]);
113111
}
114112

115-
$builder->add('code', TextType::class, [
116-
'required' => false
117-
]);
113+
$builder
114+
->add('code', TextType::class, [
115+
'required' => false
116+
])
117+
->add('template', TextType::class,[
118+
'required' => false,
119+
]);
118120
}
121+
119122
if (!$options['is_content']) {
120123
$builder
121124
->add('redirect', TEChooseLinkType::class, [

0 commit comments

Comments
 (0)