Umherirrender has uploaded a new change for review. https://gerrit.wikimedia.org/r/179547
Change subject: Parse label-message of HtmlForm with context ...................................................................... Parse label-message of HtmlForm with context Store a Message object in constructor and parse that object, when the context is known Avoid: [GlobalTitleFail] MessageCache::parse called by Message::toString/Message::parseText/MessageCache::parse with no title set Change-Id: I876673da580deb0e9fda6c25c947e8f8622b71f3 --- M includes/htmlform/HTMLCheckField.php M includes/htmlform/HTMLFormField.php 2 files changed, 12 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/47/179547/1 diff --git a/includes/htmlform/HTMLCheckField.php b/includes/htmlform/HTMLCheckField.php index 5f70362..05ead6e 100644 --- a/includes/htmlform/HTMLCheckField.php +++ b/includes/htmlform/HTMLCheckField.php @@ -26,11 +26,11 @@ array( 'class' => 'mw-ui-checkbox-label' ), - Xml::check( $this->mName, $value, $attr ) . $this->mLabel ); + Xml::check( $this->mName, $value, $attr ) . parent::getLabel() ); } else { $chkLabel = Xml::check( $this->mName, $value, $attr ) . ' ' - . Html::rawElement( 'label', array( 'for' => $this->mID ), $this->mLabel ); + . Html::rawElement( 'label', array( 'for' => $this->mID ), parent::getLabel() ); if ( $wgUseMediaWikiUIEverywhere ) { $chkLabel = Html::rawElement( diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 4cf2394..4313061 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -10,7 +10,7 @@ protected $mValidationCallback; protected $mFilterCallback; protected $mName; - protected $mLabel; # String label. Set on construction + protected $mLabel; # String label, null or Message object. Set on construction protected $mID; protected $mClass = ''; protected $mHelpClass = false; @@ -354,7 +354,8 @@ $msgInfo = array(); } - $this->mLabel = wfMessage( $msg, $msgInfo )->parse(); + // Get parsed in getLabel when context is known + $this->mLabel = wfMessage( $msg, $msgInfo ); } elseif ( isset( $params['label'] ) ) { if ( $params['label'] === ' ' ) { // Apparently some things set   directly and in an odd format @@ -671,7 +672,13 @@ } function getLabel() { - return is_null( $this->mLabel ) ? '' : $this->mLabel; + if ( is_null( $this->mLabel ) ) { + return ''; + } + if ( $this->mLabel instanceof Message ) { + $this->mLabel->setContext( $this->mParent->getContext() )->parse(); + } + return $this->mLabel; } function getLabelHtml( $cellAttributes = array() ) { -- To view, visit https://gerrit.wikimedia.org/r/179547 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I876673da580deb0e9fda6c25c947e8f8622b71f3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits