Skip to content

Commit

Permalink
Fix for opening new tab from picker (openemr#7168)
Browse files Browse the repository at this point in the history
The twig custom function function ($subject = 'default', $fieldName = "_token") sig arg $subject will not default to arg value unless null is passed in. Quote counts as populated.

(cherry picked from commit 63732ad)
  • Loading branch information
sjpadgett committed Feb 21, 2024
1 parent c24410c commit a3f1e61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Common/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ function ($eventName, $eventData = array()) {
new TwigFunction(
'csrfToken',
function ($subject = 'default', $fieldName = "_token") {
if (empty($subject)) {
$subject = 'default';
}
return sprintf('<input type="hidden" name="%s" value="%s">', $fieldName, attr(CsrfUtils::collectCsrfToken($subject)));
}
),
Expand Down

0 comments on commit a3f1e61

Please sign in to comment.