// No form input yet
return true;
}
- try {
- $titleObj = Title::newFromTextThrow( $title );
- } catch ( MalformedTitleException $e ) {
- $msg = $this->msg( $e->getErrorMessage() );
- $params = $e->getErrorMessageParameters();
- if ( $params ) {
- $msg->params( $params );
- }
- return $msg->parse();
- }
- if ( !$titleObj->canExist() ) {
- return $this->msg(
- 'changecontentmodel-title-cantexist',
- $titleObj->getPrefixedText()
- )->escaped();
- }
+
+ // Already validated by HTMLForm, but if not, throw
+ // and exception instead of a fatal
+ $titleObj = Title::newFromTextThrow( $title );
$this->oldRevision = Revision::newFromTitle( $titleObj ) ?: false;
$that = $this;
$fields = array(
'pagetitle' => array(
- 'type' => 'text',
+ 'type' => 'title',
+ 'creatable' => true,
'name' => 'pagetitle',
'default' => $this->par,
'label-message' => 'changecontentmodel-title-label',
"changecontentmodel-success-title": "The content model was changed",
"changecontentmodel-success-text": "The content type of [[:$1]] has been changed.",
"changecontentmodel-cannot-convert": "The content on [[:$1]] cannot be converted to a type of $2.",
- "changecontentmodel-title-cantexist": "It is not possible to have a page at $1.",
"changecontentmodel-nodirectediting": "The $1 content model does not support direct editing",
"log-name-contentmodel": "Content model change log",
"log-description-contentmodel": "Events related to the content models of a page",
"changecontentmodel-success-title": "Title of the success page of the change content model special page",
"changecontentmodel-success-text": "Message telling user that their change has been successfully done.\n* $1 - Target page title",
"changecontentmodel-cannot-convert": "Error message shown if the content model cannot be changed to the specified type. $1 is the page title, $2 is the localized content model name.",
- "changecontentmodel-title-cantexist": "Error message shown if the page the user provided is a special page.\n\nParameters:\n* $1 - the page title which cannot exist",
"changecontentmodel-nodirectediting": "Error message shown if the content model does not allow for direct editing. $1 is the localized name of the content model.",
"log-name-contentmodel": "{{doc-logpage}}\n\nTitle of [[Special:Log/contentmodel]].",
"log-description-contentmodel": "Text in [[Special:Log/contentmodel]].",