49 if ( $this->mParams[
'interwiki'] && $this->mParams[
'relative'] ) {
52 throw new InvalidArgumentException(
'relative and interwiki may not be used together' );
57 if ( !$this->mParams[
'required'] && $value ===
'' ) {
59 return parent::validate( $value, $alldata );
64 if ( !$this->mParams[
'relative'] ) {
65 $title = $titleFactory->newFromTextThrow( $value );
68 $title = $titleFactory->newFromTextThrow( Title::makeName( $this->mParams[
'namespace'], $value ) );
74 if ( $title->isExternal() ) {
75 if ( $this->mParams[
'interwiki'] ) {
77 return parent::validate( $value, $alldata );
79 return $this->
msg(
'htmlform-title-interwiki', $title->getPrefixedText() );
83 $text = $title->getPrefixedText();
84 if ( $this->mParams[
'namespace'] !==
false &&
85 !$title->inNamespace( $this->mParams[
'namespace'] )
87 return $this->
msg(
'htmlform-title-badnamespace', $text, $this->mParams[
'namespace'] );
90 if ( $this->mParams[
'creatable'] && !$title->canExist() ) {
91 return $this->
msg(
'htmlform-title-not-creatable', $text );
94 if ( $this->mParams[
'exists'] && !$title->exists() ) {
95 return $this->
msg(
'htmlform-title-not-exists', $text );
98 return parent::validate( $value, $alldata );