mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler
synced 2024-11-24 00:07:10 +00:00
Move pdfhandler.messages module to extension.json
These messages have not changed since they were originally defined
in f4f87ceb
(2015). Instead of using a hook to register the module
at runtime, put it in extension.json with a note next to the warning
configuration to keep the messages in sync.
Change-Id: I135bf1a9f2cd59926a40cc565e5c8a2a6f2483c0
This commit is contained in:
parent
2e5afea2bc
commit
2328f802b1
|
@ -39,10 +39,15 @@
|
|||
"i18n"
|
||||
]
|
||||
},
|
||||
"Hooks": {
|
||||
"ResourceLoaderRegisterModules": [
|
||||
"MediaWiki\\Extension\\PdfHandler\\PdfHandler::registerWarningModule"
|
||||
]
|
||||
"ResourceModules": {
|
||||
"pdfhandler.messages": {
|
||||
"messages": [
|
||||
"pdf-file-page-warning",
|
||||
"pdf-file-page-warning-header",
|
||||
"pdf-file-page-warning-info",
|
||||
"pdf-file-page-warning-footer"
|
||||
]
|
||||
}
|
||||
},
|
||||
"MediaHandlers": {
|
||||
"application/pdf": "MediaWiki\\Extension\\PdfHandler\\PdfHandler"
|
||||
|
|
|
@ -9,7 +9,6 @@ use MediaTransformError;
|
|||
use MediaTransformOutput;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use PoolCounterWorkViaCallback;
|
||||
use ResourceLoader;
|
||||
use ThumbnailImage;
|
||||
use TransformParameterError;
|
||||
|
||||
|
@ -36,6 +35,11 @@ use TransformParameterError;
|
|||
*/
|
||||
|
||||
class PdfHandler extends ImageHandler {
|
||||
/**
|
||||
* Keep in sync with pdfhandler.messages in extension.json
|
||||
*
|
||||
* @see getWarningConfig
|
||||
*/
|
||||
private const MESSAGES = [
|
||||
'main' => 'pdf-file-page-warning',
|
||||
'header' => 'pdf-file-page-warning-header',
|
||||
|
@ -447,16 +451,6 @@ class PdfHandler extends ImageHandler {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a module with the warning messages in it.
|
||||
* @param ResourceLoader &$resourceLoader
|
||||
*/
|
||||
public static function registerWarningModule( &$resourceLoader ) {
|
||||
$resourceLoader->register( 'pdfhandler.messages', [
|
||||
'messages' => array_values( self::MESSAGES ),
|
||||
] );
|
||||
}
|
||||
|
||||
public function useSplitMetadata() {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue