add text page
This commit is contained in:
parent
61f8fca06e
commit
36487fe685
|
@ -23,6 +23,10 @@ core:
|
||||||
name: 'RSS'
|
name: 'RSS'
|
||||||
templates:
|
templates:
|
||||||
- {name: "Par défaut", file: "page/rss/default.xml.twig"}
|
- {name: "Par défaut", file: "page/rss/default.xml.twig"}
|
||||||
|
App\Entity\Page\TextPage:
|
||||||
|
name: 'Texte'
|
||||||
|
templates:
|
||||||
|
- {name: "Par défaut", file: "page/text/default.txt.twig"}
|
||||||
|
|
||||||
fos_js_routing:
|
fos_js_routing:
|
||||||
routes_to_expose:
|
routes_to_expose:
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Api\TTRssClient;
|
||||||
|
use App\Core\Controller\Site\PageController;
|
||||||
|
use App\Markdown\Parser\Post as PostParser;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class TextController extends PageController
|
||||||
|
{
|
||||||
|
public function text(): Response
|
||||||
|
{
|
||||||
|
$response = new Response();
|
||||||
|
$response->headers->set('Content-Type', 'text/plain');
|
||||||
|
|
||||||
|
return $this->defaultRender($this->siteRequest->getPage()->getTemplate(), [], $response);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Entity\Page;
|
||||||
|
|
||||||
|
use App\Core\Entity\Site\Page\Block;
|
||||||
|
use App\Core\Entity\Site\Page\FileBlock;
|
||||||
|
use App\Core\Form\Site\Page\TextareaBlockType;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use App\Core\Entity\Site\Page\Page;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Entity
|
||||||
|
*/
|
||||||
|
class TextPage extends Page
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
$builder->add(
|
||||||
|
'content',
|
||||||
|
TextareaBlockType::class,
|
||||||
|
[
|
||||||
|
'label' => 'Contenu',
|
||||||
|
'options' => [
|
||||||
|
'attr' => [
|
||||||
|
'rows' => '50',
|
||||||
|
],
|
||||||
|
'constraints' => [
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setContent(Block $block)
|
||||||
|
{
|
||||||
|
return $this->setBlock($block);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent()
|
||||||
|
{
|
||||||
|
return $this->getBlock('content');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
{{ _page.content.value|raw }}
|
Loading…
Reference in New Issue