MediaWiki master
ContentTransformer.php
Go to the documentation of this file.
1<?php
3
9
16 public function __construct(
17 private readonly IContentHandlerFactory $contentHandlerFactory,
18 ) {
19 }
20
25 public function preSaveTransform(
26 Content $content,
27 PageReference $page,
28 UserIdentity $user,
29 ParserOptions $parserOptions
30 ): Content {
31 $contentHandler = $this->contentHandlerFactory->getContentHandler( $content->getModel() );
32 $pstParams = new PreSaveTransformParamsValue( $page, $user, $parserOptions );
33
34 return $contentHandler->preSaveTransform( $content, $pstParams );
35 }
36
41 public function preloadTransform(
42 Content $content,
43 PageReference $page,
44 ParserOptions $parserOptions,
45 array $params = []
46 ): Content {
47 $contentHandler = $this->contentHandlerFactory->getContentHandler( $content->getModel() );
48 $pltParams = new PreloadTransformParamsValue( $page, $parserOptions, $params );
49
50 return $contentHandler->preloadTransform( $content, $pltParams );
51 }
52}
preloadTransform(Content $content, PageReference $page, ParserOptions $parserOptions, array $params=[])
Returns a Content object with preload transformations applied (or $content if no transformations appl...
__construct(private readonly IContentHandlerFactory $contentHandlerFactory,)
preSaveTransform(Content $content, PageReference $page, UserIdentity $user, ParserOptions $parserOptions)
Returns a Content object with pre-save transformations applied (or $content if no transformations app...
Set options of the Parser.
Content objects represent page content, e.g.
Definition Content.php:28
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Interface for objects representing user identity.