Custom Fields: API to detect forms containing only hidden fields

SVN:trunk[4095]
This commit is contained in:
Romain Quetiez
2016-05-17 14:09:38 +00:00
parent 6e8ee09399
commit 6b465688a2
2 changed files with 20 additions and 1 deletions

View File

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

View File

@@ -406,6 +406,25 @@ class Form
return ($this->GetEditableFieldCount() > 0);
}
/**
* 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