48 if ( $this->mParams[
'interwiki'] && $this->mParams[
'relative'] ) {
51 throw new InvalidArgumentException(
'relative and interwiki may not be used together' );
54 if ( $value ===
null ) {
58 if ( !$this->mParams[
'required'] && $value ===
'' ) {
60 return parent::validate( $value, $alldata );
65 if ( !$this->mParams[
'relative'] ) {
66 $title = $titleFactory->newFromTextThrow( $value );
69 $title = $titleFactory->newFromTextThrow( Title::makeName( $this->mParams[
'namespace'], $value ) );
75 if ( $title->isExternal() ) {
76 if ( $this->mParams[
'interwiki'] ) {
78 return parent::validate( $value, $alldata );
80 return $this->
msg(
'htmlform-title-interwiki', $title->getPrefixedText() );
84 $text = $title->getPrefixedText();
85 if ( $this->mParams[
'namespace'] !==
false &&
86 !$title->inNamespace( $this->mParams[
'namespace'] )
88 return $this->
msg(
'htmlform-title-badnamespace', $text, $this->mParams[
'namespace'] );
91 if ( $this->mParams[
'creatable'] && !$title->canExist() ) {
92 return $this->
msg(
'htmlform-title-not-creatable', $text );
95 if ( $this->mParams[
'exists'] && !$title->exists() ) {
96 return $this->
msg(
'htmlform-title-not-exists', $text );
99 return parent::validate( $value, $alldata );