MediaWiki master
ContentTransformer.php
Go to the documentation of this file.
1<?php
3
9
16 private IContentHandlerFactory $contentHandlerFactory;
17
18 public function __construct( IContentHandlerFactory $contentHandlerFactory ) {
19 $this->contentHandlerFactory = $contentHandlerFactory;
20 }
21
26 public function preSaveTransform(
27 Content $content,
28 PageReference $page,
29 UserIdentity $user,
30 ParserOptions $parserOptions
31 ): Content {
32 $contentHandler = $this->contentHandlerFactory->getContentHandler( $content->getModel() );
33 $pstParams = new PreSaveTransformParamsValue( $page, $user, $parserOptions );
34
35 return $contentHandler->preSaveTransform( $content, $pstParams );
36 }
37
42 public function preloadTransform(
43 Content $content,
44 PageReference $page,
45 ParserOptions $parserOptions,
46 array $params = []
47 ): Content {
48 $contentHandler = $this->contentHandlerFactory->getContentHandler( $content->getModel() );
49 $pltParams = new PreloadTransformParamsValue( $page, $parserOptions, $params );
50
51 return $contentHandler->preloadTransform( $content, $pltParams );
52 }
53}
__construct(IContentHandlerFactory $contentHandlerFactory)
preloadTransform(Content $content, PageReference $page, ParserOptions $parserOptions, array $params=[])
Returns a Content object with preload transformations applied (or $content if no transformations appl...
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.