Skip to content

Commit

Permalink
#10521 Add hooks to extend Publisher Library categories (#10534)
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored Oct 22, 2024
1 parent 631d1a8 commit 270bb11
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions classes/file/PKPLibraryFileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use PKP\context\LibraryFile;
use PKP\context\LibraryFileDAO;
use PKP\db\DAORegistry;
use PKP\plugins\Hook;

class PKPLibraryFileManager extends PrivateFileManager
{
Expand Down Expand Up @@ -168,6 +169,7 @@ public function getFileSuffixFromType($type)
/**
* Get the type => suffix mapping array
*
* @hook PublisherLibrary::types::suffixes [[&$map]]
* @return array
*/
public function &getTypeSuffixMap()
Expand All @@ -178,6 +180,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 @@ -199,6 +202,7 @@ public function getNameFromType($type)
/**
* Get the type => locale key mapping array
*
* @hook PublisherLibrary::types::titles [[&$map]]
* @return array
*/
public function &getTypeTitleKeyMap()
Expand All @@ -209,6 +213,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 @@ -226,6 +231,7 @@ public function getTitleKeyFromType($type)
/**
* Get the type => name mapping array
*
* @hook PublisherLibrary::types::names [[&$typeNameMap]]
* @return array
*/
public function &getTypeNameMap()
Expand All @@ -236,6 +242,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 270bb11

Please sign in to comment.