Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#10521 Add hooks to extend Publisher Library categories #10522

Open
wants to merge 1 commit into
base: stable-3_3_0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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