Skip to content

Commit 5a54e01

Browse files
authored
Merge pull request #1563 from nowackipawel/patch-26
id attribute support added for csrf_field
2 parents 48e3795 + 9ad16be commit 5a54e01

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

system/Common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,9 @@ function csrf_hash()
692692
*
693693
* @return string
694694
*/
695-
function csrf_field()
695+
function csrf_field(string $id = null)
696696
{
697-
return '<input type="hidden" name="' . csrf_token() . '" value="' . csrf_hash() . '">';
697+
return '<input type="hidden"' . (!empty($id) ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_token() . '" value="' . csrf_hash() . '" />';
698698
}
699699
}
700700

0 commit comments

Comments
 (0)