protected function alterForm( HTMLForm $form ) {
}
+ /**
+ * Whether the form should use OOUI
+ * @return bool
+ */
+ protected function usesOOUI() {
+ return false;
+ }
+
/**
* Get the HTMLForm to control behavior
* @return HTMLForm|null
// Give hooks a chance to alter the form, adding extra fields or text etc
Hooks::run( 'ActionModifyFormFields', [ $this->getName(), &$this->fields, $this->page ] );
- $form = new HTMLForm( $this->fields, $this->getContext(), $this->getName() );
+ if ( $this->usesOOUI() ) {
+ $form = HTMLForm::factory( 'ooui', $this->fields, $this->getContext(), $this->getName() );
+ } else {
+ $form = new HTMLForm( $this->fields, $this->getContext(), $this->getName() );
+ }
$form->setSubmitCallback( [ $this, 'onSubmit' ] );
$title = $this->getTitle();
}
}
- protected function alterForm( HTMLForm $form ) {
- $form->setSubmitTextMsg( 'confirm_purge_button' );
+ protected function usesOOUI() {
+ return true;
}
- protected function preText() {
- return $this->msg( 'confirm-purge-top' )->parse();
+ protected function getFormFields() {
+ return [
+ 'intro' => [
+ 'type' => 'info',
+ 'vertical-label' => true,
+ 'raw' => true,
+ 'default' => $this->msg( 'confirm-purge-top' )->parse()
+ ]
+ ];
+ }
+
+ protected function alterForm( HTMLForm $form ) {
+ $form->setWrapperLegendMsg( 'confirm-purge-title' );
+ $form->setSubmitTextMsg( 'confirm_purge_button' );
}
protected function postText() {
}
}
+ protected function usesOOUI() {
+ return true;
+ }
+
protected function alterForm( HTMLForm $form ) {
$form->setWrapperLegendMsg( 'filerevert-legend' );
$form->setSubmitTextMsg( 'filerevert-submit' );
return 'unwatch';
}
- protected function getDescription() {
- return $this->msg( 'removewatch' )->escaped();
- }
-
public function onSubmit( $data ) {
self::doUnwatch( $this->getTitle(), $this->getUser() );
return true;
}
- protected function alterForm( HTMLForm $form ) {
- $form->setSubmitTextMsg( 'confirm-unwatch-button' );
+ protected function getFormFields() {
+ return [
+ 'intro' => [
+ 'type' => 'info',
+ 'vertical-label' => true,
+ 'raw' => true,
+ 'default' => $this->msg( 'confirm-unwatch-top' )->parse()
+ ]
+ ];
}
- protected function preText() {
- return $this->msg( 'confirm-unwatch-top' )->parse();
+ protected function alterForm( HTMLForm $form ) {
+ parent::alterForm( $form );
+ $form->setWrapperLegendMsg( 'removewatch' );
+ $form->setSubmitTextMsg( 'confirm-unwatch-button' );
}
public function onSuccess() {
return false;
}
- /**
- * @return string HTML
- */
protected function getDescription() {
- return $this->msg( 'addwatch' )->escaped();
+ return '';
}
public function onSubmit( $data ) {
parent::checkCanExecute( $user );
}
+ protected function usesOOUI() {
+ return true;
+ }
+
+ protected function getFormFields() {
+ return [
+ 'intro' => [
+ 'type' => 'info',
+ 'vertical-label' => true,
+ 'raw' => true,
+ 'default' => $this->msg( 'confirm-watch-top' )->parse()
+ ]
+ ];
+ }
+
protected function alterForm( HTMLForm $form ) {
+ $form->setWrapperLegendMsg( 'addwatch' );
$form->setSubmitTextMsg( 'confirm-watch-button' );
$form->setTokenSalt( 'watch' );
}
- protected function preText() {
- return $this->msg( 'confirm-watch-top' )->parse();
- }
-
public function onSuccess() {
$msgKey = $this->getTitle()->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext';
$this->getOutput()->addWikiMsg( $msgKey, $this->getTitle()->getPrefixedText() );
"confirmrecreate-noreason": "User [[User:$1|$1]] ([[User talk:$1|talk]]) {{GENDER:$1|deleted}} this page after you started editing. Please confirm that you really want to recreate this page.",
"recreate": "Recreate",
"unit-pixel": "px",
+ "confirm-purge-title": "Purge this page",
"confirm_purge_button": "OK",
"confirm-purge-top": "Clear the cache of this page?",
"confirm-purge-bottom": "Purging a page clears the cache and forces the most current revision to appear.",
"confirmrecreate-noreason": "Followed by the checkbox which has the label {{msg-mw|Recreate}}.\n\nParameters:\n* $1 - username, also used for GENDER support\n* $2 - (Unused) reason\nSee also:\n* {{msg-mw|Confirmrecreate}}",
"recreate": "Text shown when the editor fails to save the page due to it having been deleted since they opened VE. $1 is the message {{msg-mw|ooui-dialog-process-continue}}.",
"unit-pixel": "{{optional}}\npx is the abbreviation for \"pixel\".",
+ "confirm-purge-title": "Title for the confirmation form that appears when the user is about to purge the page.",
"confirm_purge_button": "Used as Submit button text.\n{{Identical|OK}}",
"confirm-purge-top": "Used as confirmation message.",
"confirm-purge-bottom": "Additional description for Purge form.",