Skip to content

Commit

Permalink
#10521 Add hooks to extend Publisher Library categories (#10522)
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored Oct 22, 2024
1 parent ae219f5 commit f60a7ff
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions classes/file/PKPLibraryFileManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function &copyFromTemporaryFile(&$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) {
Expand All @@ -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) {
Expand All @@ -151,6 +151,8 @@ function getFileSuffixFromType($type) {

/**
* Get the type => suffix mapping array
*
* @hook PublisherLibrary::types::suffixes [[&$map]]
* @return array
*/
function &getTypeSuffixMap() {
Expand All @@ -160,6 +162,7 @@ function &getTypeSuffixMap() {
LIBRARY_FILE_TYPE_REPORT => 'REP',
LIBRARY_FILE_TYPE_OTHER => 'OTH'
);
HookRegistry::call('PublisherLibrary::types::suffixes', [&$map]);
return $map;
}

Expand All @@ -178,6 +181,8 @@ function getNameFromType($type) {

/**
* Get the type => locale key mapping array
*
* @hook PublisherLibrary::types::titles [[&$map]]
* @return array
*/
function &getTypeTitleKeyMap() {
Expand All @@ -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;
}

Expand All @@ -201,6 +207,8 @@ function getTitleKeyFromType($type) {

/**
* Get the type => name mapping array
*
* @hook PublisherLibrary::types::names [[&$typeNameMap]]
* @return array
*/
function &getTypeNameMap() {
Expand All @@ -210,6 +218,7 @@ function &getTypeNameMap() {
LIBRARY_FILE_TYPE_REPORT => 'reports',
LIBRARY_FILE_TYPE_OTHER => 'other',
);
HookRegistry::call('PublisherLibrary::types::names', [&$typeNameMap]);
return $typeNameMap;
}
}
Expand Down

0 comments on commit f60a7ff

Please sign in to comment.