<?php


namespace App\Components\Forms;


use App\Model\Facades\SiteFacade;
use App\Model\Translator;

abstract class NewsForm extends BaseForm
{
    public $onSave;
    public $onPublish;
    public $onError;

    /** @var SiteFacade */
    protected $siteFacade;

    public function __construct(Translator $translator, SiteFacade $siteFacade)
    {
        parent::__construct($translator);
        $this->siteFacade = $siteFacade;
    }

    protected function setupForm() : BootstrapForm
    {
        $form = parent::setupForm();

        $form->addText('title', 'Title')->setRequired();
        $form->addSelect('language', $this->translator->translate('Language'), $this->translator->getSupportedLocales())
            ->setDefaultValue($this->translator->getLanguage()->getIdentifier())
            ->setTranslator(null);
        $form->addTextArea('description', 'Description')->setRequired();
        $form->addTextArea('content', 'Content')->setAttribute('class', ['tinymce']);

        return $form;
    }
}