jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/332122 )
Change subject: Clarify the rendering option code, and fix a wfMessage call. ...................................................................... Clarify the rendering option code, and fix a wfMessage call. Change-Id: I109bae450f31b80b2da2ca36bf236f6c165351ff --- M includes/content/CollaborationListContent.php 1 file changed, 27 insertions(+), 8 deletions(-) Approvals: Brian Wolff: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/content/CollaborationListContent.php b/includes/content/CollaborationListContent.php index 337ef22..8e26866 100644 --- a/includes/content/CollaborationListContent.php +++ b/includes/content/CollaborationListContent.php @@ -188,12 +188,15 @@ $output->addJsConfigVars( 'wgCollaborationKitIsMemberList', $isMemberList ); } - private function getOverrideOptions() { - $this->decode(); - $opts = (array)$this->options; - return []; - } - + /** + * Get rendering options to use when directly viewing the list page + * + * These are used on direct page views, and plain wikitext + * transclusions. They are not used when using the parser function. + * + * @todo FIXME These should maybe not be used during transclusion. + * @return Array Options + */ private function getFullRenderListOptions() { return $listOptions = [ 'includeDesc' => true, @@ -211,7 +214,7 @@ */ public function convertToWikitext( Language $lang, $options = [] ) { $this->decode(); - $options = $options + $this->getOverrideOptions() + $this->getDefaultOptions(); + $options = $options + $this->getDefaultOptions(); $maxItems = $options['maxItems']; $includeDesc = $options['includeDesc']; @@ -219,7 +222,11 @@ // just return the plain JSON. if ( $this->displaymode == 'error' ) { - $errorWikitext = '<div class=errorbox>' . wfMessage( 'collaborationkit-list-invalid' ) . "</div>\n<pre>" . $this->errortext . '</pre>'; + $errorWikitext = '<div class=errorbox>' . + wfMessage( 'collaborationkit-list-invalid' )->inLanguage( $lang )->plain() . + "</div>\n<pre>" . + $this->errortext . + '</pre>'; return $errorWikitext; } @@ -383,6 +390,18 @@ return parent::convert( $toModel, $lossy ); } + /** + * Default rendering options. + * + * These are used when rendering a list and no option + * value was specified. getFullRenderListOptions() will + * override some of these values when a list page is directly + * viewed. + * + * Any new option must be added to this list. + * + * @return Array default rendering options to use. + */ public function getDefaultOptions() { // FIXME implement // FIXME use defaults from schema instead of hardcoded values -- To view, visit https://gerrit.wikimedia.org/r/332122 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I109bae450f31b80b2da2ca36bf236f6c165351ff Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CollaborationKit Gerrit-Branch: master Gerrit-Owner: Brian Wolff <bawolff...@gmail.com> Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits