public function processCreateSubpage($formData) { if (!isset($formData['WpId']) || !isset($formData['SpName'])) { throw new MWException('Cannot create Wikiplace, no data.'); } $wikiplace = WpWikiplace::getById(intval($formData['WpId'])); if (!$wikiplace instanceof WpWikiplace) { return wfMessage('wp-invalid-name')->text(); } $content = self::preparePageContent($formData['Template'], $formData['License']); $user = $this->getUser(); $subpage = WpPage::createSubpage($wikiplace, $formData['SpName'], $user, $content); if (!$subpage instanceof Title) { $key = array_shift($subpage); return wfMessage($key, $subpage)->parse(); } $this->homepageString = $wikiplace->getName(); $this->subpageString = $formData['SpName']; if ($formData['CreateTalk'] === true) { // The wikiplace was created by a hook and is not accessible from here, so we need to get the wikiplace this way $talkContent = '{{Subst:' . wfMessage('wp-default-talk')->text() . '}}'; $talk_page = WpPage::createTalk($subpage, $user, $talkContent); if (!$talk_page instanceof Title) { // wikiplace was created, but, error on talk /** @todo show a warning ? */ } } return true; // all ok :) }