X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fchangetags%2FChangeTags.php;h=6ba9c10a706370c0fe72861cbefd7eae1379144f;hb=f7e1770fb832aa77bf4e16ce8cc815f2b24dd10d;hp=ff6a8730c5931e10e238dc5590c968699a837c16;hpb=7f3d6713e7191c476adb3d3c30344a0327b853d3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index ff6a8730c5..6ba9c10a70 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -120,6 +120,32 @@ class ChangeTags { return $msg->parse(); } + /** + * Get the message object for the tag's long description. + * + * Checks if message key "mediawiki:tag-$tag-description" exists. If it does not, + * or if message is disabled, returns false. Otherwise, returns the message object + * for the long description. + * + * @param string $tag Tag + * @param IContextSource $context + * @return Message|bool Message object of the tag long description or false if + * there is no description. + */ + public static function tagLongDescriptionMessage( $tag, IContextSource $context ) { + $msg = $context->msg( "tag-$tag-description" ); + if ( !$msg->exists() ) { + return false; + } + if ( $msg->isDisabled() ) { + // The message exists but is disabled, hide the description. + return false; + } + + // Message exists and isn't disabled, use it. + return $msg; + } + /** * Add tags to a change given its rc_id, rev_id and/or log_id *