From f60a7ffc4d4b167999ede223b28cb65c8df532de Mon Sep 17 00:00:00 2001 From: Nate Wright Date: Tue, 22 Oct 2024 22:40:37 +0100 Subject: [PATCH] pkp/pkp-lib#10521 Add hooks to extend Publisher Library categories (#10522) --- classes/file/PKPLibraryFileManager.inc.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/classes/file/PKPLibraryFileManager.inc.php b/classes/file/PKPLibraryFileManager.inc.php index 2bb13da8dc8..2bfc2005ac6 100644 --- a/classes/file/PKPLibraryFileManager.inc.php +++ b/classes/file/PKPLibraryFileManager.inc.php @@ -106,7 +106,7 @@ function ©FromTemporaryFile(&$temporaryFile, $libraryFileType) { * Routine to replace a library file from a temporary file. * @param $temporaryFile object * @param $libraryFileType int LIBRARY_FILE_TYPE_... - * @param $libraryFile LibraryFile + * @param $libraryFile LibraryFile * @return LibraryFile|false the updated LibraryFile, or false on error */ function &replaceFromTemporaryFile(&$temporaryFile, $libraryFileType, $libraryFile) { @@ -127,7 +127,7 @@ function &replaceFromTemporaryFile(&$temporaryFile, $libraryFileType, $libraryFi * Routine to assign metadata to a library file from a temporary file * @param $temporaryFile object * @param $libraryFileType int LIBRARY_FILE_TYPE_... - * @param $libraryFile LibraryFile + * @param $libraryFile LibraryFile * @return LibraryFile the updated LibraryFile */ function &assignFromTemporaryFile(&$temporaryFile, $libraryFileType, $libraryFile) { @@ -151,6 +151,8 @@ function getFileSuffixFromType($type) { /** * Get the type => suffix mapping array + * + * @hook PublisherLibrary::types::suffixes [[&$map]] * @return array */ function &getTypeSuffixMap() { @@ -160,6 +162,7 @@ function &getTypeSuffixMap() { LIBRARY_FILE_TYPE_REPORT => 'REP', LIBRARY_FILE_TYPE_OTHER => 'OTH' ); + HookRegistry::call('PublisherLibrary::types::suffixes', [&$map]); return $map; } @@ -178,6 +181,8 @@ function getNameFromType($type) { /** * Get the type => locale key mapping array + * + * @hook PublisherLibrary::types::titles [[&$map]] * @return array */ function &getTypeTitleKeyMap() { @@ -187,6 +192,7 @@ function &getTypeTitleKeyMap() { LIBRARY_FILE_TYPE_REPORT => 'settings.libraryFiles.category.reports', LIBRARY_FILE_TYPE_OTHER => 'settings.libraryFiles.category.other' ); + HookRegistry::call('PublisherLibrary::types::titles', [&$map]); return $map; } @@ -201,6 +207,8 @@ function getTitleKeyFromType($type) { /** * Get the type => name mapping array + * + * @hook PublisherLibrary::types::names [[&$typeNameMap]] * @return array */ function &getTypeNameMap() { @@ -210,6 +218,7 @@ function &getTypeNameMap() { LIBRARY_FILE_TYPE_REPORT => 'reports', LIBRARY_FILE_TYPE_OTHER => 'other', ); + HookRegistry::call('PublisherLibrary::types::names', [&$typeNameMap]); return $typeNameMap; } }