From d8949ece1ce6938ed4e9940aa5ddf61b8db496a5 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 17 Dec 2013 08:30:15 -0600
Subject: [PATCH] forms: Allow getFields() to find field from key

If the form is constructed as a hash array of fields, allow the getField()
method to return the field based on the key of the fields hash array
---
 include/class.forms.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/class.forms.php b/include/class.forms.php
index cfa0a1cef..b5a780240 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -51,9 +51,12 @@ class Form {
     }
 
     function getField($name) {
-        foreach($this->getFields() as $f)
+        $fields = $this->getFields();
+        foreach($fields as $f)
             if(!strcasecmp($f->get('name'), $name))
                 return $f;
+        if (isset($fields[$name]))
+            return $fields[$name];
     }
 
     function getTitle() { return $this->title; }
-- 
GitLab