1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-17 02:24:05 +02:00

feat(form-plugin): add _csrfHiddenField #360

This commit is contained in:
Awilum
2020-02-08 17:06:43 +03:00
parent f4dedfbca1
commit bb942cc02d
2 changed files with 7 additions and 4 deletions

View File

@@ -591,10 +591,11 @@ class FormController extends Controller
*/
protected function _csrfHiddenField() : string
{
$field = '<input type="hidden" name="' . $this->flextype['csrf']->getTokenNameKey() . '" value="' . $this->flextype['csrf']->getTokenName() . '">';
$field .= '<input type="hidden" name="' . $this->flextype['csrf']->getTokenValueKey() . '" value="' . $this->flextype['csrf']->getTokenValue() . '">';
return $field;
return $this->flextype['view']->fetch('plugins/form/templates/fields/hidden-csrf/field.html',
['getTokenNameKey' => $this->flextype['csrf']->getTokenNameKey(),
'getTokenName' => $this->flextype['csrf']->getTokenName(),
'getTokenValueKey' => $this->flextype['csrf']->getTokenValueKey(),
'getTokenValue' => $this->flextype['csrf']->getTokenValue()]);
}
/**

View File

@@ -0,0 +1,2 @@
<input type="hidden" name="{{ getTokenNameKey }}" value="{{ getTokenName }}">
<input type="hidden" name="{{ getTokenValueKey }}" value="{{ getTokenValue }}">