Closed GabrielMajeri closed 1 year ago
What I found so far: the ListPanels
aren't configurable using PHP, rather they are defined in the Vue-based PKP UI library. To customize the submissions list view, we'd have to edit the original JavaScript source code, recompile it and update it in-place on our app instance.
Instead, I managed to get the following done using PHP exclusively:
The trick: while we cannot edit the UI code directly, we can change the values we pass it from the back end. I've modified the returned fullTitle
property to also include the internal ID, if it exists.
I've added the following lines to the plugin setup code:
Hook::add('Submission::getSubmissionsListProps', function ($hookName, $params) {
$props = &$params[0];
$props[] = 'internalId';
});
And I've had to modify the application source code directly (the file is lib/pkp/pages/dashboard/DashboardHandler.php
, starting at line 121):
$items = $items->map(function ($submission) {
$internalId = $submission['internalId'];
$submission['publications'] = $submission['publications']->map(function ($publication) use ($internalId) {
if (strlen($internalId) > 0) {
$publication['fullTitle']['en'] = '(' . $internalId . ') ' . $publication['fullTitle']['en'];
}
return $publication;
});
return $submission;
});
I've added a new column to display this field in the submissions list panel:
The corresponding changes are in https://github.com/GabrielMajeri/ui-library/commit/6d9139065c1e2bcf22ab51e866cf8e87fda5baf4
After implementing #6, we will have the submissions' internal IDs stored in the database, but an editor has to enter each submission individually if they want to determine its ID.
Instead, it would be great if we could list this internal ID in a separate column on the submissions list page:
We'll have to study a bit the
ListPanels
components used by the PKP UI system.