Jelajahi Sumber

Custom Fields: API to detect forms containing only hidden fields

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4095 a333f486-631f-4898-b8df-5754b55c2be0
romainq 9 tahun lalu
induk
melakukan
0646f900c6

+ 1 - 1
sources/form/field/hiddenfield.class.inc.php

@@ -28,5 +28,5 @@ use \Combodo\iTop\Form\Field\TextField;
  */
 class HiddenField extends TextField
 {
-   
+	const DEFAULT_HIDDEN = true;
 }

+ 19 - 0
sources/form/form.class.inc.php

@@ -407,6 +407,25 @@ class Form
 	}
 
 	/**
+	 * Returns true if the form has at least one editable field
+	 *
+	 * @return boolean
+	 */
+	public function HasVisibleFields()
+	{
+		$bRet = false;
+		foreach ($this->aFields as $oField)
+		{
+			if (!$oField->GetHidden())
+			{
+				$bRet = true;
+				break;
+			}
+		}
+		return $bRet;
+	}
+
+	/**
 	 * @param $sFormPath
 	 * @return Form|null
 	 */