summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Widget/PluginOutputContainer.php
blob: a8ff578910b2a54b7158554911db59fcac5cf90e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */

namespace Icinga\Module\Icingadb\Widget;

use Icinga\Module\Icingadb\Util\PluginOutput;
use ipl\Html\BaseHtmlElement;

class PluginOutputContainer extends BaseHtmlElement
{
    protected $tag = 'div';

    public function __construct(PluginOutput $output)
    {
        $this->setHtmlContent($output);

        $this->getAttributes()->registerAttributeCallback('class', function () use ($output) {
            return $output->isHtml() ? 'plugin-output' : 'plugin-output preformatted';
        });
    }
}