From a23b1c7b3bc8924927c23ef403354e1841521b23 Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 23 Aug 2019 18:05:01 +0300 Subject: [PATCH] feat(core): add new protected methods in Forms class #218 #186 Methods: - csrfHiddenField() - actionHiddenField() --- flextype/core/Forms.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/flextype/core/Forms.php b/flextype/core/Forms.php index 2298b425..3302f590 100644 --- a/flextype/core/Forms.php +++ b/flextype/core/Forms.php @@ -11,6 +11,7 @@ namespace Flextype; use Flextype\Component\Arr\Arr; use Flextype\Component\Form\Form; +use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use function count; use function Flextype\Component\I18n\__; @@ -46,13 +47,12 @@ class Forms * * @access public */ - public function fetch(array $fieldset, array $values = [], Request $request) : string + public function fetch(array $fieldset, array $values = [], Request $request, Response $response) : string { $form = ''; $form .= Form::open(null, ['id' => 'form']); - $form .= '' . - $form .= ''; - $form .= Form::hidden('action', 'save-form'); + $form .= $this->csrfHiddenField(); + $form .= $this->actionHiddenField(); if (count($fieldset['sections']) > 0) { $form .= '