Contents

TextArea

The TextArea control provides a box of limitless size allowing the user to enter large bodies of text.

It has no special attributes or behaviours.

<?php

namespace Rhubarb\Leaf\Controls\Common\Examples\Text\TextArea;

use Rhubarb\Leaf\Leaves\Leaf;

class TextArea extends Leaf
{
    /**
    * @var TextAreaModel
    */
    protected $model;
    
    protected function getViewClass()
    {
        return TextAreaView::class;
    }
    
    protected function createModel()
    {
        return new TextAreaModel();
    }
}
                                    
<?php

namespace Rhubarb\Leaf\Controls\Common\Examples\Text\TextArea;

use Rhubarb\Leaf\Leaves\LeafModel;

class TextAreaModel extends LeafModel
{
    public $description;
}
                                    
<?php

namespace Rhubarb\Leaf\Controls\Common\Examples\Text\TextArea;

use Rhubarb\Leaf\Controls\Common\Text\TextArea;
use Rhubarb\Leaf\Views\View;

class TextAreaView extends View
{
    /**
    * @var TextAreaModel
    */
    protected $model;

    protected function createSubLeaves()
    {
        $this->registerSubLeaf(
            $description = new TextArea("description")
        );

        $description->setPlaceholderText("Enter a description");
    }

    protected function printViewContent()
    {
        print $this->leaves["description"];
    }
}