<?php

namespace App\Entity\Page;

use App\Core\Entity\Site\Page\Block;
use App\Core\Entity\Site\Page\FileBlock;
use App\Form\Type\SimpleMdTextareaBlockType;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Form\FormBuilderInterface;

/**
 * @ORM\Entity
 */
class SimplePage extends TitledPage
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $builder->add(
            'content',
            SimpleMdTextareaBlockType::class,
            [
                'label' => 'Contenu',
                'options' => [
                    'attr' => [
                        'rows' => '50',
                    ],
                    'constraints' => [
                    ],
                ],
            ]
        );
    }

    public function setContent(Block $block)
    {
        return $this->setBlock($block);
    }

    public function getContent()
    {
        return $this->getBlock('content');
    }

    public function setImage(Block $block)
    {
        return $this->setBlock($block);
    }

    public function getImage()
    {
        return $this->getBlock('image', FileBlock::class);
    }
}
