HTMLForm: Improve method interface for collapsible forms
Also minor tweaks:
* Fix @since tags, this did not make it into 1.33
* Fix usage of FieldsetLayout 'group' in OOUIHTMLForm
* Documentation changes
Follow-up to 2896e87a10,
per my post-merge review on that commit.
Change-Id: Ib93375cde19730a46e4929878d6e472d3ac8f631
This commit is contained in:
parent
31e768e643
commit
36d33daa03
3 changed files with 18 additions and 17 deletions
|
|
@ -267,7 +267,7 @@ class HistoryAction extends FormlessAction {
|
|||
$htmlForm
|
||||
->setMethod( 'get' )
|
||||
->setAction( wfScript() )
|
||||
->setCollapsible( true )
|
||||
->setCollapsibleOptions( true )
|
||||
->setId( 'mw-history-searchform' )
|
||||
->setSubmitText( $this->msg( 'historyaction-submit' )->text() )
|
||||
->setWrapperAttributes( [ 'id' => 'mw-history-search' ] )
|
||||
|
|
|
|||
|
|
@ -222,15 +222,15 @@ class HTMLForm extends ContextSource {
|
|||
protected $mAction = false;
|
||||
|
||||
/**
|
||||
* Whether the HTML form can be collapsed
|
||||
* @since 1.33
|
||||
* Whether the form can be collapsed
|
||||
* @since 1.34
|
||||
* @var bool
|
||||
*/
|
||||
protected $mCollapsible = false;
|
||||
|
||||
/**
|
||||
* Whether the HTML form IS collapsed by default
|
||||
* @since 1.33
|
||||
* Whether the form is collapsed by default
|
||||
* @since 1.34
|
||||
* @var bool
|
||||
*/
|
||||
protected $mCollapsed = false;
|
||||
|
|
@ -1062,14 +1062,15 @@ class HTMLForm extends ContextSource {
|
|||
}
|
||||
|
||||
/**
|
||||
* Make the form collapsible
|
||||
* @since 1.33
|
||||
* @param bool $collapsed whether it should be by default
|
||||
* @return HTMLForm $this for chaining calls (since 1.20)
|
||||
* Set whether the HTML form can be collapsed.
|
||||
*
|
||||
* @since 1.34
|
||||
* @param bool $collapsedByDefault (optional) whether the form is collapsed by default
|
||||
* @return HTMLForm $this for chaining calls
|
||||
*/
|
||||
public function setCollapsible( $collapsed = false ) {
|
||||
public function setCollapsibleOptions( $collapsedByDefault = false ) {
|
||||
$this->mCollapsible = true;
|
||||
$this->mCollapsed = $collapsed;
|
||||
$this->mCollapsed = $collapsedByDefault;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -290,13 +290,13 @@ class OOUIHTMLForm extends HTMLForm {
|
|||
'classes' => $classes,
|
||||
'group' => new OOUI\StackLayout( [
|
||||
'expanded' => false,
|
||||
'classes' => [ 'oo-ui-fieldsetLayout-group mw-collapsible-content' ],
|
||||
'items' => [
|
||||
new OOUI\Widget( [
|
||||
'content' => new OOUI\HtmlSnippet( $html )
|
||||
] ),
|
||||
],
|
||||
'classes' => [ 'mw-collapsible-content' ],
|
||||
] ),
|
||||
'items' => [
|
||||
new OOUI\Widget( [
|
||||
'content' => new OOUI\HtmlSnippet( $html )
|
||||
] ),
|
||||
],
|
||||
] + OOUI\Element::configFromHtmlAttributes( $this->mWrapperAttributes ) );
|
||||
} else {
|
||||
$content = new OOUI\HtmlSnippet( $html );
|
||||
|
|
|
|||
Loading…
Reference in a new issue