2626use OpenConext \EngineBlockBundle \Value \FeedbackInformation ;
2727use OpenConext \EngineBlockBundle \Value \FeedbackInformationMap ;
2828use SAML2 \XML \saml \Issuer ;
29- use Twig \Extension \AbstractExtension ;
30- use Twig \TwigFunction ;
29+ use Twig \Attribute \AsTwigFunction ;
3130
32- class Feedback extends AbstractExtension
31+ class Feedback
3332{
3433 /**
3534 * @var EngineBlock_ApplicationSingleton
@@ -63,23 +62,7 @@ public function __construct(
6362 $ this ->samlResponseHelper = $ samlResponseHelper ;
6463 }
6564
66- public function getFunctions (): array
67- {
68- return [
69- new TwigFunction ('feedbackInfo ' , $ this ->getFeedbackInfo (...)),
70- new TwigFunction ('flushLog ' , $ this ->flushLog (...)),
71- new TwigFunction ('hasBackToSpLink ' , $ this ->hasBackToSpLink (...)),
72- new TwigFunction ('hasWikiLink ' , $ this ->hasWikiLink (...)),
73- new TwigFunction ('getWikiLink ' , $ this ->getWikiLink (...)),
74- new TwigFunction ('hasIdPContactMailLink ' , $ this ->hasIdPContactMailLink (...)),
75- new TwigFunction ('getIdPContactMailLink ' , $ this ->getIdPContactMailLink (...)),
76- new TwigFunction ('getIdpContactShortLabel ' , $ this ->getIdpContactShortLabel (...)),
77- new TwigFunction ('getSpName ' , $ this ->getSpName (...)),
78- new TwigFunction ('getAcu ' , $ this ->getAcu (...)),
79- new TwigFunction ('getSamlFailedResponse ' , $ this ->getSamlFailedResponse (...)),
80- ];
81- }
82-
65+ #[AsTwigFunction(name: 'flushLog ' )]
8366 public function flushLog ($ message )
8467 {
8568 // For now use the EngineBlock_ApplicationSingleton to flush the log
@@ -89,6 +72,7 @@ public function flushLog($message)
8972 /**
9073 * @return FeedbackInformationMap
9174 */
75+ #[AsTwigFunction(name: 'feedbackInfo ' )]
9276 public function getFeedbackInfo ()
9377 {
9478 return $ this ->retrieveFeedbackInfo ();
@@ -98,6 +82,7 @@ public function getFeedbackInfo()
9882 * @param string $templateName
9983 * @return bool
10084 */
85+ #[AsTwigFunction(name: 'hasWikiLink ' )]
10186 public function hasWikiLink ($ templateName )
10287 {
10388 return $ this ->errorFeedbackConfiguration ->hasWikiLink ($ templateName );
@@ -107,6 +92,7 @@ public function hasWikiLink($templateName)
10792 * @param string $templateName
10893 * @return string
10994 */
95+ #[AsTwigFunction(name: 'getWikiLink ' )]
11096 public function getWikiLink ($ templateName )
11197 {
11298 return $ this ->errorFeedbackConfiguration ->getWikiLink ($ templateName );
@@ -116,6 +102,7 @@ public function getWikiLink($templateName)
116102 * @param string $templateName
117103 * @return bool
118104 */
105+ #[AsTwigFunction(name: 'hasIdPContactMailLink ' )]
119106 public function hasIdPContactMailLink ($ templateName )
120107 {
121108 return $ this ->errorFeedbackConfiguration ->isIdPContactPage ($ templateName ) && $ this ->getIdPContactMailLink ();
@@ -125,6 +112,7 @@ public function hasIdPContactMailLink($templateName)
125112 * @param string $templateName
126113 * @return string
127114 */
115+ #[AsTwigFunction(name: 'getIdpContactShortLabel ' )]
128116 public function getIdpContactShortLabel ($ templateName )
129117 {
130118 return $ this ->errorFeedbackConfiguration ->getIdpContactShortLabel ($ templateName );
@@ -133,6 +121,7 @@ public function getIdpContactShortLabel($templateName)
133121 /**
134122 * @return string
135123 */
124+ #[AsTwigFunction(name: 'getIdPContactMailLink ' )]
136125 public function getIdPContactMailLink ()
137126 {
138127 $ feedbackInfo = $ this ->retrieveFeedbackInfo ();
@@ -153,6 +142,7 @@ public function getIdPContactMailLink()
153142 return '' ;
154143 }
155144
145+ #[AsTwigFunction(name: 'hasBackToSpLink ' )]
156146 public function hasBackToSpLink (): bool
157147 {
158148 $ info = $ this ->retrieveFeedbackInfo ();
@@ -165,17 +155,20 @@ public function hasBackToSpLink(): bool
165155 return $ response !== '' ;
166156 }
167157
158+ #[AsTwigFunction(name: 'getSpName ' )]
168159 public function getSpName (): ?string
169160 {
170161 return $ this ->getFeedbackInfo ()->get ('serviceProviderName ' ) ?? $ this ->getFeedbackInfo ()->get ('serviceProvider ' );
171162 }
172163
164+ #[AsTwigFunction(name: 'getAcu ' )]
173165 public function getAcu (): string
174166 {
175167 $ info = $ this ->retrieveFeedbackInfo ();
176168 return $ this ->samlResponseHelper ->getAcu ($ info ->get ('serviceProvider ' ));
177169 }
178170
171+ #[AsTwigFunction(name: 'getSamlFailedResponse ' )]
179172 public function getSamlFailedResponse (): string
180173 {
181174 $ session = $ this ->application ->getSession ();
0 commit comments