MediaWiki REL1_31
ReplaceTextUtils.php
Go to the documentation of this file.
1<?php
21use \MediaWiki\MediaWikiServices;
22
24
31 public static function link( Title $title, $text = null ) {
32 if ( method_exists( '\MediaWiki\MediaWikiServices', 'getLinkRenderer' ) ) {
33 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
34 if ( class_exists( 'HtmlArmor' ) && !is_null( $text ) ) {
35 $text = new HtmlArmor( $text );
36 }
37 return $linkRenderer->makeLink( $title, $text );
38 };
39 return Linker::link( $title, $text );
40 }
41}
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:28
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition Linker.php:107
static link(Title $title, $text=null)
Shim for compatibility.
Represents a title within MediaWiki.
Definition Title.php:39
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition hooks.txt:2056