mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Introduce class MarkdownText
This commit is contained in:
parent
5cdad5f122
commit
d061de728f
1 changed files with 28 additions and 0 deletions
28
library/Icingadb/Common/MarkdownText.php
Normal file
28
library/Icingadb/Common/MarkdownText.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */
|
||||
|
||||
namespace Icinga\Module\Icingadb\Common;
|
||||
|
||||
use Icinga\Web\Helper\Markdown;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\DeferredText;
|
||||
|
||||
class MarkdownText extends BaseHtmlElement
|
||||
{
|
||||
protected $tag = 'section';
|
||||
|
||||
protected $defaultAttributes = ['class' => 'markdown'];
|
||||
|
||||
/**
|
||||
* MarkdownText constructor.
|
||||
*
|
||||
* @param string $text
|
||||
*/
|
||||
public function __construct($text)
|
||||
{
|
||||
$this->add((new DeferredText(function () use ($text) {
|
||||
return Markdown::text($text);
|
||||
}))->setEscaped(true));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue