// 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',
throw new RuntimeException( "Form submission was not POSTed" );
}
- $this->title = Title::newFromText( $data['pagetitle' ] );
+ $this->title = Title::newFromText( $data['pagetitle'] );
$user = $this->getUser();
// Check permissions and make sure the user has permission to edit the specific page
$errors = $this->title->getUserPermissionsErrors( 'editcontentmodel', $user );