/** * Converts the content of the template according to the given type. * @param Title $title * @param sting $content * @param string $type One of types specified in the TemplateClassificationController * @return string * @throws MWException */ public function createDraftContent(Title $title, $content, $type) { $newContent = ''; if ($type === TemplateClassificationController::TEMPLATE_INFOBOX) { /** * While we're at it we can mark the base template as an infobox */ $parentTitle = Title::newFromText($title->getBaseText(), $title->getNamespace()); $tc = new TemplateClassificationController($parentTitle); $tc->classifyTemplate(TemplateClassificationController::TEMPLATE_INFOBOX, true); $templateConverter = new TemplateConverter($title); $newContent = $templateConverter->convertAsInfobox($content); $newContent .= $templateConverter->generatePreviewSection($content); } return $newContent; }