Skip to content

Commit 88bf4cd

Browse files
committed
Custom limitation: applied suggestions
1 parent 6cbcf60 commit 88bf4cd

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

code_samples/back_office/limitation/src/Controller/CustomController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@ public function customAction(Request $request): Response
4242

4343
private function getCustomLimitationValue(): bool
4444
{
45-
$hasAccess = $this->permissionResolver->hasAccess('custom_module', 'custom_function_2');
45+
$hasAccess = $this->permissionResolver->hasAccess('custom_module', 'custom_function_2');
4646

4747
if (is_bool($hasAccess)) {
4848
return $hasAccess;
4949
}
5050

51-
$customLimitationValues = $this->permissionChecker->getRestrictions($hasAccess, CustomLimitationValue::class);
51+
$customLimitationValues = $this->permissionChecker->getRestrictions(
52+
$hasAccess,
53+
CustomLimitationValue::class
54+
);
5255

5356
return $customLimitationValues['value'] ?? false;
5457
}

code_samples/back_office/limitation/src/Security/Limitation/Mapper/CustomLimitationValueMapper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
class CustomLimitationValueMapper implements LimitationValueMapperInterface
1111
{
12-
/** return array<bool> */
12+
/**
13+
* @return array<bool>
14+
*/
1315
public function mapLimitationValue(Limitation $limitation): array
1416
{
1517
return [$limitation->limitationValues['value']];
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{# templates/themes/standard/limitation/custom_limitation_value.html.twig #}
22
{% block ez_limitation_customlimitation_value %}
3-
{% set isSet = values | first %}
4-
<span style="color: {{ isSet ? 'green' : 'red' }};">{{ isSet ? 'Yes' : 'No' }}</span>
3+
{% set is_set = values | first %}
4+
<span style="color: {{ is_set ? 'green' : 'red' }};">{{ is_set ? 'Yes' : 'No' }}</span>
55
{% endblock %}

0 commit comments

Comments
 (0)