<?php

namespace App\Form\Type;

use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;

class SimpleMdTextareaType extends TextareaType
{
    /**
     * {@inheritdoc}
     */
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        if (!isset($view->vars['attr']['data-simplemde'])) {
            $view->vars['attr']['data-simplemde'] = '';
        }

        if (!isset($view->vars['attr']['rows'])) {
            $view->vars['attr']['rows'] = 20;
        }

        return parent::buildView($view, $form, $options);
    }
}
