Skip to content

Commit

Permalink
pkp#229 Replaced IsoCodesFactory by Locale method
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasraoni committed Apr 15, 2023
1 parent 0623ad8 commit 93f9ece
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions OrcidProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
use PKP\core\JSONMessage;
use PKP\core\PKPApplication;
use PKP\db\DAORegistry;
use PKP\facades\Locale;
use PKP\form\Form;
use PKP\install\Installer;
use PKP\linkAction\LinkAction;
Expand All @@ -70,7 +71,7 @@
use PKP\submission\PKPSubmission;
use PKP\submission\reviewAssignment\ReviewAssignment;
use PKP\submission\reviewAssignment\ReviewAssignmentDAO;
use Sokil\IsoCodes\IsoCodesFactory;
use Sokil\IsoCodes\Database\Countries\Country;

class OrcidProfilePlugin extends GenericPlugin
{
Expand Down Expand Up @@ -1099,12 +1100,11 @@ public function manage($args, $request)
ORCID_API_URL_MEMBER_SANDBOX => 'plugins.generic.orcidProfile.manager.settings.orcidProfileAPIPath.memberSandbox'
]);

$isoCodes = new IsoCodesFactory();
$countries = [];
foreach ($isoCodes->getCountries() as $country) {
$countries[$country->getAlpha2()] = $country->getLocalName();
}
asort($countries);
$countries = collect(Locale::getCountries())
->mapWithKeys(fn (Country $country) => [$country->getAlpha2() => $country->getLocalName()])
->sort(fn (string $a, string $b) => strcoll($a, $b))
->toArray();

$templateMgr->assign('countries', $countries);
$templateMgr->assign('logLevelOptions', [
'ERROR' => 'plugins.generic.orcidProfile.manager.settings.logLevel.error',
Expand Down

0 comments on commit 93f9ece

Please sign in to comment.