48 if ( $this->mParams[
'interwiki'] && $this->mParams[
'relative'] ) {
51 throw new InvalidArgumentException(
'relative and interwiki may not be used together' );
56 if ( !$this->mParams[
'required'] && $value ===
'' ) {
58 return parent::validate( $value, $alldata );
63 if ( !$this->mParams[
'relative'] ) {
64 $title = $titleFactory->newFromTextThrow( $value );
67 $title = $titleFactory->newFromTextThrow( Title::makeName( $this->mParams[
'namespace'], $value ) );
73 if ( $title->isExternal() ) {
74 if ( $this->mParams[
'interwiki'] ) {
76 return parent::validate( $value, $alldata );
78 return $this->
msg(
'htmlform-title-interwiki', $title->getPrefixedText() );
82 $text = $title->getPrefixedText();
83 if ( $this->mParams[
'namespace'] !==
false &&
84 !$title->inNamespace( $this->mParams[
'namespace'] )
86 return $this->
msg(
'htmlform-title-badnamespace', $text, $this->mParams[
'namespace'] );
89 if ( $this->mParams[
'creatable'] && !$title->canExist() ) {
90 return $this->
msg(
'htmlform-title-not-creatable', $text );
93 if ( $this->mParams[
'exists'] && !$title->exists() ) {
94 return $this->
msg(
'htmlform-title-not-exists', $text );
97 return parent::validate( $value, $alldata );