MediaWiki master
ContentTransformer.php
Go to the documentation of this file.
1<?php
3
9
17 private $contentHandlerFactory;
18
19 public function __construct( IContentHandlerFactory $contentHandlerFactory ) {
20 $this->contentHandlerFactory = $contentHandlerFactory;
21 }
22
34 public function preSaveTransform(
35 Content $content,
36 PageReference $page,
37 UserIdentity $user,
38 ParserOptions $parserOptions
39 ): Content {
40 $contentHandler = $this->contentHandlerFactory->getContentHandler( $content->getModel() );
41 $pstParams = new PreSaveTransformParamsValue( $page, $user, $parserOptions );
42
43 return $contentHandler->preSaveTransform( $content, $pstParams );
44 }
45
57 public function preloadTransform(
58 Content $content,
59 PageReference $page,
60 ParserOptions $parserOptions,
61 array $params = []
62 ): Content {
63 $contentHandler = $this->contentHandlerFactory->getContentHandler( $content->getModel() );
64 $pltParams = new PreloadTransformParamsValue( $page, $parserOptions, $params );
65
66 return $contentHandler->preloadTransform( $content, $pltParams );
67 }
68}
__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:42
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Interface for objects representing user identity.