public function processCreateTagForm(array $data, HTMLForm $form) { $context = $form->getContext(); $out = $context->getOutput(); $tag = trim(strval($data['Tag'])); $ignoreWarnings = isset($data['IgnoreWarnings']) && $data['IgnoreWarnings'] === '1'; $status = ChangeTags::createTagWithChecks($tag, $data['Reason'], $context->getUser(), $ignoreWarnings); if ($status->isGood()) { $out->redirect($this->getPageTitle()->getLocalURL()); return true; } elseif ($status->isOK()) { // we have some warnings, so we show a confirmation form $fields = ['Tag' => ['type' => 'hidden', 'default' => $data['Tag']], 'Reason' => ['type' => 'hidden', 'default' => $data['Reason']], 'IgnoreWarnings' => ['type' => 'hidden', 'default' => '1']]; // fool HTMLForm into thinking the form hasn't been submitted yet. Otherwise // we get into an infinite loop! $context->getRequest()->unsetVal('wpEditToken'); $headerText = $this->msg('tags-create-warnings-above', $tag, count($status->getWarningsArray()))->parseAsBlock() . $out->parse($status->getWikiText()) . $this->msg('tags-create-warnings-below')->parseAsBlock(); $subform = new HTMLForm($fields, $this->getContext()); $subform->setAction($this->getPageTitle('create')->getLocalURL()); $subform->setWrapperLegendMsg('tags-create-heading'); $subform->setHeaderText($headerText); $subform->setSubmitCallback([$this, 'processCreateTagForm']); $subform->setSubmitTextMsg('htmlform-yes'); $subform->show(); $out->addBacklinkSubtitle($this->getPageTitle()); return true; } else { $out->addWikiText("<div class=\"error\">\n" . $status->getWikiText() . "\n</div>"); return false; } }