Tidy up the Form widget object, allFields and formWidgets no longer public

This commit is contained in:
Sam Georges 2014-08-03 10:18:42 +10:00
parent eeda9f5f0d
commit f99bd0e427
1 changed files with 41 additions and 2 deletions

View File

@ -21,6 +21,7 @@ use System\Classes\ApplicationException;
*/
class Form extends WidgetBase
{
/**
* {@inheritDoc}
*/
@ -44,12 +45,12 @@ class Form extends WidgetBase
/**
* @var array Collection of all fields used in this form.
*/
public $allFields = [];
protected $allFields = [];
/**
* @var array Collection of all form widgets used in this form.
*/
public $formWidgets = [];
protected $formWidgets = [];
/**
* @var array Collection of fields not contained in a tab.
@ -563,6 +564,44 @@ class Form extends WidgetBase
return $this->formWidgets[$field->columnName] = $widget;
}
/**
* Get all the loaded form widgets for the instance.
* @return array
*/
public function getFormWidgets()
{
return $this->formWidgets;
}
/**
* Get a specified form widget
* @param string $columnName
* @return mixed
*/
public function getFormWidget($field)
{
return $this->formWidgets[$field];
}
/**
* Get all the registered fields for the instance.
* @return array
*/
public function getFields()
{
return $this->allFields;
}
/**
* Get a specified field object
* @param string $columnName
* @return mixed
*/
public function getField($field)
{
return $this->allFields[$field];
}
/**
* Parses a field's name
* @param stirng $field Field name