summaryrefslogtreecommitdiffstats
path: root/library/Reporting/Web/Forms/DecoratedElement.php
blob: 257868110de21e8094e0ee6c5b4534f3d5e92d7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
// Icinga Reporting | (c) 2019 Icinga GmbH | GPLv2

namespace Icinga\Module\Reporting\Web\Forms;

use ipl\Html\Contract\FormElementDecorator;

trait DecoratedElement
{
    protected function addDecoratedElement(FormElementDecorator $decorator, $type, $name, array $attributes)
    {
        $element = $this->createElement($type, $name, $attributes);
        $decorator->decorate($element);
        $this->registerElement($element);
        $this->add($element);
    }
}