Create ContentTransformer to access ContentHandler::preSaveTransform through the service. Prepare object to hold a data that required for ContentHandler::preSaveTranform params. This will require making a semi-backwards-incompatible change no matter what, we don't really have a great way of hard-deprecating overriding methods. However, with the ContentHandler calling Content and Content calling ContentHandler, and with the ProxyContent trick to stop infinite recursion, it doesn't matter whether callers use Content or ContentHandler. This will allow us to naturally convert all callers. But won't really allow hard-deprecation. Bug: T287156 Change-Id: If6a2025868ceca3a3b6f11baec39695e47292e40
51 lines
954 B
PHP
51 lines
954 B
PHP
<?php
|
|
namespace MediaWiki\Content\Transform;
|
|
|
|
use MediaWiki\Page\PageReference;
|
|
use MediaWiki\User\UserIdentity;
|
|
use ParserOptions;
|
|
|
|
/**
|
|
* @internal
|
|
* An object to hold pre-save transform params.
|
|
*/
|
|
class PreSaveTransformParamsValue implements PreSaveTransformParams {
|
|
/** @var PageReference */
|
|
private $page;
|
|
|
|
/** @var UserIdentity */
|
|
private $user;
|
|
|
|
/** @var ParserOptions */
|
|
private $parserOptions;
|
|
|
|
public function __construct( PageReference $page, UserIdentity $user, ParserOptions $parserOptions ) {
|
|
$this->page = $page;
|
|
$this->user = $user;
|
|
$this->parserOptions = $parserOptions;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return PageReference
|
|
*/
|
|
public function getPage(): PageReference {
|
|
return $this->page;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return UserIdentity
|
|
*/
|
|
public function getUser(): UserIdentity {
|
|
return $this->user;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return ParserOptions
|
|
*/
|
|
public function getParserOptions(): ParserOptions {
|
|
return $this->parserOptions;
|
|
}
|
|
}
|