diff options
Diffstat (limited to '')
-rw-r--r-- | library/Icingadb/Widget/PluginOutputContainer.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/library/Icingadb/Widget/PluginOutputContainer.php b/library/Icingadb/Widget/PluginOutputContainer.php new file mode 100644 index 0000000..a8ff578 --- /dev/null +++ b/library/Icingadb/Widget/PluginOutputContainer.php @@ -0,0 +1,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'; + }); + } +} |