SvgDocumentFactory
Read onlyYes
FinalYes
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.
not part of TYPO3 Core API.
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
__construct()
public
__construct(SvgSanitizer $svgSanitizer) : mixed
Parameters
- $svgSanitizer : SvgSanitizer
fromFile()
public
fromFile(FileInterface|string $file) : SvgDocument
Parameters
- $file : FileInterface|string
Return values
SvgDocumentfromString()
public
fromString(string $svg) : SvgDocument
Parameters
- $svg : string
Return values
SvgDocumentfromStringAndSanitize()
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.