Skip to content

Instantly share code, notes, and snippets.

@mainframe98
Created September 26, 2018 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mainframe98/376479136055c4c94a5d2453e640cc76 to your computer and use it in GitHub Desktop.
Save mainframe98/376479136055c4c94a5d2453e640cc76 to your computer and use it in GitHub Desktop.
A special page showcasing OOUI HTMLFormFieldCloner. Use in conjunction with https://gerrit.wikimedia.org/r/c/mediawiki/core/+/421373
<?php
class SpecialTest extends FormSpecialPage {
public function __construct() {
parent::__construct( 'Test', '', false );
}
protected function getFormFields() : array {
return [
'clone' => [
'type' => 'cloner',
'label' => 'cloner',
'help' => 'Some Help Text',
'fields' => [
'title' => [
'type' => 'int',
'help' => 'Some Help Text'
]
],
'default' => [
[ 'title' => 5 ],
[ 'title' => 7 ]
]
]
];
}
public function onSubmit( array $data ) {
wfVarDump( $data );
return true;
}
protected function getDisplayFormat() {
$useooui = $this->getRequest()->getBool( 'useooui', true );
return $useooui ? 'ooui' : 'table';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment