mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
# Conflicts: # README.md # composer.json # composer.lock # core/cmdbsource.class.inc.php # core/dbobject.class.php # datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php # datamodels/2.x/combodo-db-tools/dbtools.php # datamodels/2.x/combodo-db-tools/dictionaries/zh_cn.dict.combodo-db-tools.php # datamodels/2.x/itop-attachments/dictionaries/zh_cn.dict.itop-attachments.php # datamodels/2.x/itop-core-update/dictionaries/zh_cn.dict.itop-core-update.php # dictionaries/zh_cn.dictionary.itop.core.php # dictionaries/zh_cn.dictionary.itop.ui.php # lib/composer/InstalledVersions.php # lib/composer/autoload_classmap.php # lib/composer/autoload_static.php # lib/composer/installed.php # lib/composer/platform_check.php # pages/ajax.render.php # pages/csvimport.php # setup/ajax.dataloader.php # setup/index.php # setup/setuputils.class.inc.php # test/application/UtilsTest.php
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
|
* @license http://opensource.org/licenses/AGPL-3.0
|
|
*/
|
|
|
|
|
|
namespace Combodo\iTop\Application\UI\Base\Layout;
|
|
|
|
|
|
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
|
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
|
|
|
class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory
|
|
{
|
|
public const TWIG_TAG_NAME = 'UIContentBlock';
|
|
public const UI_BLOCK_CLASS_NAME = UIContentBlock::class;
|
|
|
|
public static function MakeStandard(string $sId = null, array $aContainerClasses = [])
|
|
{
|
|
return new UIContentBlock($sId, $aContainerClasses);
|
|
}
|
|
|
|
|
|
/**
|
|
* Used to display a block of code like <pre> but allows line break.
|
|
* The \n are replaced by <br>
|
|
*
|
|
* @param string $sCode
|
|
* @param string|null $sId
|
|
*/
|
|
public static function MakeForCode(string $sCode, string $sId = null)
|
|
{
|
|
$oCode = new UIContentBlock($sId, ['ibo-is-code']);
|
|
$sCode = str_replace("\n", '<br>', $sCode);
|
|
$oCode->AddSubBlock(new Html($sCode));
|
|
|
|
return $oCode;
|
|
}
|
|
|
|
public static function MakeForPreformatted(string $sCode, string $sId = null)
|
|
{
|
|
$sCode = '<pre>'.$sCode.'</pre>';
|
|
|
|
return static::MakeForCode($sCode, $sId);
|
|
}
|
|
} |