mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PdfHandler
synced 2024-11-27 17:50:47 +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"
|
"i18n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Hooks": {
|
"ResourceModules": {
|
||||||
"ResourceLoaderRegisterModules": [
|
"pdfhandler.messages": {
|
||||||
"MediaWiki\\Extension\\PdfHandler\\PdfHandler::registerWarningModule"
|
"messages": [
|
||||||
]
|
"pdf-file-page-warning",
|
||||||
|
"pdf-file-page-warning-header",
|
||||||
|
"pdf-file-page-warning-info",
|
||||||
|
"pdf-file-page-warning-footer"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"MediaHandlers": {
|
"MediaHandlers": {
|
||||||
"application/pdf": "MediaWiki\\Extension\\PdfHandler\\PdfHandler"
|
"application/pdf": "MediaWiki\\Extension\\PdfHandler\\PdfHandler"
|
||||||
|
|
|
@ -9,7 +9,6 @@ use MediaTransformError;
|
||||||
use MediaTransformOutput;
|
use MediaTransformOutput;
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
use PoolCounterWorkViaCallback;
|
use PoolCounterWorkViaCallback;
|
||||||
use ResourceLoader;
|
|
||||||
use ThumbnailImage;
|
use ThumbnailImage;
|
||||||
use TransformParameterError;
|
use TransformParameterError;
|
||||||
|
|
||||||
|
@ -36,6 +35,11 @@ use TransformParameterError;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class PdfHandler extends ImageHandler {
|
class PdfHandler extends ImageHandler {
|
||||||
|
/**
|
||||||
|
* Keep in sync with pdfhandler.messages in extension.json
|
||||||
|
*
|
||||||
|
* @see getWarningConfig
|
||||||
|
*/
|
||||||
private const MESSAGES = [
|
private const MESSAGES = [
|
||||||
'main' => 'pdf-file-page-warning',
|
'main' => 'pdf-file-page-warning',
|
||||||
'header' => 'pdf-file-page-warning-header',
|
'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() {
|
public function useSplitMetadata() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue