Skip to content
Snippets Groups Projects
Verified Commit afb12968 authored by Pavel Břoušek's avatar Pavel Břoušek
Browse files

feat: logos option for searchbox

parent 54ad26b8
No related branches found
No related tags found
1 merge request!10feat: logos option for searchbox
......@@ -117,6 +117,8 @@ Here you can specify some identity providers to display them as a list of button
`identities` - list of identity providers to display as buttons. Each identity provider has some configuration options available. For further information, see the [identities](#identities) section below.
`logos` - optional map with keys of entity IDs and values of URLs to logos. This option can be used to override logos for some identity providers, which are expected to be used often but do not have a suitable (square) logo in their metadata.
##### identities
Each identity is a map with the following possible options:
......
......@@ -47,6 +47,9 @@ $config = [
'tags' => [],
'registration_authorities' => []
],
'logos' => [
'https://idp2.ics.muni.cz/idp/shibboleth' => 'https://id.muni.cz/android-chrome-192x192.png',
],
],
[
'name' => 'individual_identities',
......
......@@ -124,11 +124,11 @@ $data['items'] = [];
foreach ($filteredData as $entityid => $idpentry) {
$item['idpentityid'] = $entityid;
$item['image'] = Campusidp::getMostSquareLikeImg($idpentry);
$item['image'] = $searchBox['logos'][$entityid] ?? Campusidp::getMostSquareLikeImg($idpentry);
if (!empty($idpentry['name'][$_GET['language']])) {
$item['text'] = $idpentry['name'][$_GET['language']];
} elseif (!empty($item['text'] = $idpentry['name']['en'])) {
} elseif (!empty($idpentry['name']['en'])) {
$item['text'] = $idpentry['name']['en'];
} elseif (reset($idpentry['name'])) {
$item['text'] = reset($idpentry['name']);
......
......@@ -50,7 +50,8 @@ if (array_key_exists('source', $_POST)) {
$chosenIdp = [];
$chosenIdp['entityid'] = $_POST['searchbox'];
$chosenIdp['name'] = $metadata[$_POST['searchbox']]['name'];
$chosenIdp['img'] = Campusidp::getMostSquareLikeImg($metadata[$_POST['searchbox']]);
$chosenIdp['img'] = $wayfConfig['components'][$_POST['componentIndex']]['logos'][$_POST['searchbox']]
?? Campusidp::getMostSquareLikeImg($metadata[$_POST['searchbox']]);
$chosenIdp['index'] = $_POST['componentIndex'];
$prevIdps = Campusidp::getCookie(Campusidp::COOKIE_PREVIOUS_IDPS) === null ? [] : json_decode(gzinflate(base64_decode(Campusidp::getCookie(Campusidp::COOKIE_PREVIOUS_IDPS))));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment