From 19d649701d897159342bead622b1d7c956743bb4 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Wed, 12 Dec 2018 16:14:32 +0000 Subject: [PATCH] FIX Switch instanceof logic to check for a non-FormField --- src/Model/ResourceFilter.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Model/ResourceFilter.php b/src/Model/ResourceFilter.php index b14829f8..1dfd99a1 100644 --- a/src/Model/ResourceFilter.php +++ b/src/Model/ResourceFilter.php @@ -77,11 +77,16 @@ public function getCMSFields() return parent::getCMSFields(); } + /** + * {@inheritdoc} + * + * @throws InvalidArgumentException If the provided Type is not an instance of FormField + */ public function forTemplate() { $options = json_decode($this->TypeOptions, true); $field = Injector::inst()->createWithArgs($this->Type, $options); - if ($field instanceof FormField) { + if (!$field instanceof FormField) { throw new InvalidArgumentException("$this->Type is not a FormField"); } return $field;