From bdc600063471ca7e7ddf44b004f7b25206684a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sun, 3 Jan 2016 11:06:19 +0100 Subject: [PATCH] Form controller - Support for array fields --- includes/form/ctrl.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/form/ctrl.inc.php b/includes/form/ctrl.inc.php index 067df7b..0a38a66 100644 --- a/includes/form/ctrl.inc.php +++ b/includes/form/ctrl.inc.php @@ -20,8 +20,12 @@ class Ctrl_Form continue; } + $name = $field->name( ); + if ( @substr_compare( $name , '[]' , -2 , 2 ) == 0 ) { + $name = substr( $name , 0 , -2 ); + } try { - $value = $this->getParameter( $field->name( ) , $this->form->method( ) ); + $value = $this->getParameter( $name , $this->form->method( ) ); } catch ( ParameterException $e ) { $value = null; }