Skip to content

Commit

Permalink
pkp#10521 Add hooks to extend Publisher Library categories
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr committed Oct 21, 2024
1 parent b5d6e6c commit 4de4323
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion classes/file/PKPLibraryFileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use PKP\file\TemporaryFile;
use PKP\core\PKPString;
use PKP\db\DAORegistry;
use PKP\plugins\Hook;

class PKPLibraryFileManager extends PrivateFileManager
{
Expand Down Expand Up @@ -144,7 +145,7 @@ function replaceFromTemporaryFile(TemporaryFile $temporaryFile, int $libraryFile
* Routine to assign metadata to a library file from a temporary file
* @param $temporaryFile TemporaryFile
* @param $libraryFileType int LIBRARY_FILE_TYPE_...
* @param $libraryFile LibraryFile
* @param $libraryFile LibraryFile
* @return LibraryFile the updated LibraryFile
*/
function &assignFromTemporaryFile($temporaryFile, $libraryFileType, $libraryFile) {
Expand All @@ -171,6 +172,7 @@ public function getFileSuffixFromType($type)
/**
* Get the type => suffix mapping array
*
* @hook PublisherLibrary::types::suffixes [[&$map]]
* @return array
*/
public function &getTypeSuffixMap()
Expand All @@ -181,6 +183,7 @@ public function &getTypeSuffixMap()
LibraryFile::LIBRARY_FILE_TYPE_REPORT => 'REP',
LibraryFile::LIBRARY_FILE_TYPE_OTHER => 'OTH'
];
Hook::call('PublisherLibrary::types::suffixes', [&$map]);
return $map;
}

Expand All @@ -202,6 +205,7 @@ public function getNameFromType($type)
/**
* Get the type => locale key mapping array
*
* @hook PublisherLibrary::types::titles [[&$map]]
* @return array
*/
public function &getTypeTitleKeyMap()
Expand All @@ -212,6 +216,7 @@ public function &getTypeTitleKeyMap()
LibraryFile::LIBRARY_FILE_TYPE_REPORT => 'settings.libraryFiles.category.reports',
LibraryFile::LIBRARY_FILE_TYPE_OTHER => 'settings.libraryFiles.category.other'
];
Hook::call('PublisherLibrary::types::titles', [&$map]);
return $map;
}

Expand All @@ -229,6 +234,7 @@ public function getTitleKeyFromType($type)
/**
* Get the type => name mapping array
*
* @hook PublisherLibrary::types::names [[&$typeNameMap]]
* @return array
*/
public function &getTypeNameMap()
Expand All @@ -239,6 +245,7 @@ public function &getTypeNameMap()
LibraryFile::LIBRARY_FILE_TYPE_REPORT => 'reports',
LibraryFile::LIBRARY_FILE_TYPE_OTHER => 'other',
];
Hook::call('PublisherLibrary::types::names', [&$typeNameMap]);
return $typeNameMap;
}
}
Expand Down

0 comments on commit 4de4323

Please sign in to comment.