Skip to content

Commit 93993f2

Browse files
authored
Use MDUI entries for description & information URL (#19)
* Use MDUI entries for description & information URL * Remove legacy `url.about` and `descr_purpose` options
1 parent a47af6a commit 93993f2

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

docs/consent.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ The following options can be used when configuring the Consent module:
194194

195195
`showNoConsentAboutService`
196196
: Whether we will show a link to more information about the service from the
197-
no consent page (configured in the SP metadata as `url.about`). Defaults to `true`.
197+
no consent page (configured in the SP metadata as the MDUI `InformationURL`).
198+
Defaults to `true`.
198199

199200
### External options
200201

src/Controller/ConsentController.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,12 @@ public function getconsent(Request $request)
185185
$t->data['stateId'] = $stateId;
186186
$t->data['source'] = $state['Source'];
187187
$t->data['destination'] = $state['Destination'];
188-
$t->data['descr_purpose'] = $t->getEntityPropertyTranslation('descr_purpose', $state['Destination']);
188+
189+
if (isset($state['Destination']['description'])) {
190+
$t->data['descr_purpose'] = $state['Destination']['description'];
191+
} elseif (isset($state['Destination']['UIInfo']['Description'])) {
192+
$t->data['descr_purpose'] = $state['Destination']['UIInfo']['Description'];
193+
}
189194

190195
// Fetch privacy policy
191196
if (
@@ -260,8 +265,8 @@ public function noconsent(Request $request): Template
260265

261266
$aboutService = null;
262267
if (!isset($state['consent:showNoConsentAboutService']) || $state['consent:showNoConsentAboutService']) {
263-
if (isset($state['Destination']['url.about'])) {
264-
$aboutService = $state['Destination']['url.about'];
268+
if (isset($state['Destination']['UIInfo']['InformationURL'])) {
269+
$aboutService = reset($state['Destination']['UIInfo']['InformationURL']);
265270
}
266271
}
267272

templates/consentform.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p>{{ '%SPNAME% requires that the information below is transferred.'|trans({'%SPNAME%': destination|entityDisplayName() }) }}</p>
1010

1111
{% if descr_purpose is defined and descr_purpose != "" %}
12-
<p>{{ 'The purpose of %SPNAME% is %SPDESC%'|trans({'%SPNAME%': destination|entityDisplayName(), '%SPDESC%': descr_purpose }) }}</p>
12+
<p>{{ 'The purpose of %SPNAME% is %SPDESC%'|trans({'%SPNAME%': destination|entityDisplayName(), '%SPDESC%': descr_purpose|translateFromArray }) }}</p>
1313
{% endif %}
1414

1515
<form id="consent_yes" action="{{ moduleURL('consent/getconsent') }}" method="GET">

tests/src/Controller/ConsentControllerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ public static function loadState(string $id, string $stage, bool $allowMissing =
172172
'Destination' => [
173173
'entityid' => 'urn:some:sp',
174174
'name' => 'Some destination',
175-
'url.about' => 'https://example.org/about',
175+
'UIInfo' =>[
176+
'InformationURL' => ['https://example.org/about' ],
177+
],
176178
],
177179
];
178180
}

0 commit comments

Comments
 (0)