From 3b6ff531a085e55b4433a6581e345f40bd379e6f Mon Sep 17 00:00:00 2001 From: Brooke Bryan Date: Wed, 6 Jan 2021 17:32:55 +0000 Subject: [PATCH] set the handler decorator on first use --- src/Form/Form.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Form/Form.php b/src/Form/Form.php index dc86a5d..61d4f57 100644 --- a/src/Form/Form.php +++ b/src/Form/Form.php @@ -284,7 +284,11 @@ public function decorate($for): Decorator public function getHandlerDecorator($fieldName = null): DataHandlerDecorator { - return $this->_handlerDecorator[$fieldName] ?? $this->_defaultHandlerDecorator(); + if(!isset($this->_handlerDecorator[$fieldName])) + { + $this->_handlerDecorator[$fieldName] = clone $this->_defaultHandlerDecorator(); + } + return $this->_handlerDecorator[$fieldName]; } public function setHandlerDecorator(DataHandlerDecorator $decorator, string $field = null)