*
* @ingroup SpecialPage
*/
-class SpecialPage {
+class SpecialPage implements MessageLocalizer {
// The canonical name of this special page
// Also used for the default <h1> heading, @see getDescription()
protected $mName;
/**
* Get a localised Title object for a specified special page name
+ * If you don't need a full Title object, consider using TitleValue through
+ * getTitleValueFor() below.
*
* @since 1.9
* @since 1.21 $fragment parameter added
* @throws MWException
*/
public static function getTitleFor( $name, $subpage = false, $fragment = '' ) {
+ return Title::newFromTitleValue(
+ self::getTitleValueFor( $name, $subpage, $fragment )
+ );
+ }
+
+ /**
+ * Get a localised TitleValue object for a specified special page name
+ *
+ * @since 1.28
+ * @param string $name
+ * @param string|bool $subpage Subpage string, or false to not use a subpage
+ * @param string $fragment The link fragment (after the "#")
+ * @return TitleValue
+ */
+ public static function getTitleValueFor( $name, $subpage = false, $fragment = '' ) {
$name = SpecialPageFactory::getLocalNameFor( $name, $subpage );
- return Title::makeTitle( NS_SPECIAL, $name, $fragment );
+ return new TitleValue( NS_SPECIAL, $name, $fragment );
}
/**
* @return Message
* @see wfMessage
*/
- public function msg( /* $args */ ) {
+ public function msg( $key /* $args */ ) {
$message = call_user_func_array(
[ $this->getContext(), 'msg' ],
func_get_args()
* @since 1.25
*/
public function addHelpLink( $to, $overrideBaseUrl = false ) {
+ if ( $this->including() ) {
+ return;
+ }
+
global $wgContLang;
$msg = $this->msg( $wgContLang->lc( $this->getName() ) . '-helppage' );
* @since 1.28
* @return \MediaWiki\Linker\LinkRenderer
*/
- protected function getLinkRenderer() {
+ public function getLinkRenderer() {
if ( $this->linkRenderer ) {
return $this->linkRenderer;
} else {