SvgDocumentFactory

final readonly class \TYPO3\CMS\Core\Imaging\Svg\SvgDocumentFactory

Creates {@see SvgDocument} instances from strings or files.

Inject this service wherever an SVG needs to be loaded, do not construct SvgDocument directly. Transformations and serialization of a loaded document are handled by SvgDocumentService.

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
fromFile()  : SvgDocument
fromString()  : SvgDocument
fromStringAndSanitize()  : SvgDocument
Parse and fully sanitize an SVG string in one step.

Methods

fromStringAndSanitize()

Parse and fully sanitize an SVG string in one step.

public fromStringAndSanitize(string $svg[, bool $removeLinks = false ]) : SvgDocument

Parameters

$svg : string
$removeLinks : bool = false

additionally drop <a> elements, for contexts where the rendered SVG must not contain clickable areas.

Return values

SvgDocument
On this page