From: mainframe98 Date: Wed, 8 Aug 2018 10:45:04 +0000 (+0100) Subject: Fix the GlobalTitleFail debug notice for HTMLButtonFields X-Git-Tag: 1.34.0-rc.0~4524 X-Git-Url: http://git.cyclocoop.org/%22%24h/%22/ntitle=/%22%24t/%7B%24www_url%7Dadmin/compta/operations?a=commitdiff_plain;h=71ea2670a9d5f6b5c21f64034328f4ad69c5628f;p=lhc%2Fweb%2Fwiklou.git Fix the GlobalTitleFail debug notice for HTMLButtonFields These occur when buttonlabel-message is set. HTMLButtonField parses the message in its constructor, but at that point the context (provided by the form field by HTMLForm::$mParent) is not yet available. The constructor of HTMLForm assigns $mParent, but that constructor is only called after the button label message is parsed. Bug: T201497 Change-Id: I021c9ecf3bc934f2cf55ec100e799c1c12e7bc01 --- diff --git a/includes/htmlform/fields/HTMLButtonField.php b/includes/htmlform/fields/HTMLButtonField.php index 7f7f718a60..84719a7add 100644 --- a/includes/htmlform/fields/HTMLButtonField.php +++ b/includes/htmlform/fields/HTMLButtonField.php @@ -34,6 +34,11 @@ class HTMLButtonField extends HTMLFormField { public function __construct( $info ) { $info['nodata'] = true; + + $this->setShowEmptyLabel( false ); + + parent::__construct( $info ); + if ( isset( $info['flags'] ) ) { $this->mFlags = $info['flags']; } @@ -55,10 +60,6 @@ class HTMLButtonField extends HTMLFormField { } elseif ( isset( $info['buttonlabel-raw'] ) ) { $this->buttonLabel = $info['buttonlabel-raw']; } - - $this->setShowEmptyLabel( false ); - - parent::__construct( $info ); } public function getInputHTML( $value ) {