jenkins-bot has submitted this change and it was merged. Change subject: Moving citation tool code in API module into its own function ......................................................................
Moving citation tool code in API module into its own function This should slightly improve the readability and modularity of the code. Change-Id: Ie4dcbeca550129c2fcea69f011d0297f334ea235 --- M VisualEditorDataModule.php 1 file changed, 25 insertions(+), 14 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/VisualEditorDataModule.php b/VisualEditorDataModule.php index 1259507..5c36ef8 100644 --- a/VisualEditorDataModule.php +++ b/VisualEditorDataModule.php @@ -108,7 +108,30 @@ // Normalise to 'copyrightwarning' so we have a consistent key in the front-end. $msgArgs[ 'copyrightwarning' ] = $copywarnMsg; - // Citations + // Citation tools + $msgVals['visualeditor-cite-tool-definition.json'] = json_encode( self::getCitationTools() ); + + $msgKeys = array_values( array_unique( array_merge( + $msgKeys, + array_keys( $msgArgs ), + array_keys( $msgVals ) + ) ) ); + + return array( + 'keys' => $msgKeys, + 'args' => $msgArgs, + 'vals' => $msgVals, + ); + } + + /** + * Retrieve the list of citation templates that we want to make available in the + * VisualEditor toolbar (via the Cite dropdown). These are defined on-wiki at + * MediaWiki:Visualeditor-cite-tool-definition.json. + * + * @return array + */ + public static function getCitationTools() { $citationDefinition = json_decode( wfMessage( 'visualeditor-cite-tool-definition.json' )->plain() ); @@ -123,19 +146,7 @@ $citationTools[] = $tool; } } - $msgVals['visualeditor-cite-tool-definition.json'] = json_encode( $citationTools ); - - $msgKeys = array_values( array_unique( array_merge( - $msgKeys, - array_keys( $msgArgs ), - array_keys( $msgVals ) - ) ) ); - - return array( - 'keys' => $msgKeys, - 'args' => $msgArgs, - 'vals' => $msgVals, - ); + return $citationTools; } public function getMessages() { -- To view, visit https://gerrit.wikimedia.org/r/132312 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie4dcbeca550129c2fcea69f011d0297f334ea235 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Kaldari <rkald...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits