* @package UIBlockExtensibilityAPI * @api * @since 3.0.0 */ class UIContentBlockUIBlockFactory extends AbstractUIBlockFactory { /** @inheritDoc */ public const TWIG_TAG_NAME = 'UIContentBlock'; /** @inheritDoc */ public const UI_BLOCK_CLASS_NAME = UIContentBlock::class; /** * Make an empty UIContentBlock which can be used to embed anything or to surround another block with specific CSS classes. * * @api * @param string|null $sId * @param array $aContainerClasses * * @return \Combodo\iTop\Application\UI\Base\Layout\UIContentBlock */ public static function MakeStandard(string $sId = null, array $aContainerClasses = []) { return new UIContentBlock($sId, $aContainerClasses); } /** * Used to display a block of code like
but allows line break. * The \n are replaced by
* * @api * @param string $sCode * @param string|null $sId * * @return \Combodo\iTop\Application\UI\Base\Layout\UIContentBlock */ public static function MakeForCode(string $sCode, string $sId = null) { $oCode = new UIContentBlock($sId, ['ibo-is-code']); $sCode = str_replace("\n", '
', $sCode); $oCode->AddSubBlock(new Html($sCode)); return $oCode; } /** * Used to display a block of preformatted text in atag. * * @api * @param string $sCode * @param string|null $sId * * @return \Combodo\iTop\Application\UI\Base\Layout\UIContentBlock */ public static function MakeForPreformatted(string $sCode, string $sId = null) { $sCode = ''.$sCode.''; return static::MakeForCode($sCode, $sId); } }