Skip to content

Commit

Permalink
Tidy up the Form widget object, allFields and formWidgets no longer p…
Browse files Browse the repository at this point in the history
…ublic
  • Loading branch information
daftspunk committed Aug 3, 2014
1 parent eeda9f5 commit f99bd0e
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions modules/backend/widgets/Form.php
Expand Up @@ -21,6 +21,7 @@
*/
class Form extends WidgetBase
{

/**
* {@inheritDoc}
*/
Expand All @@ -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.
Expand Down Expand Up @@ -563,6 +564,44 @@ protected function makeFormWidget($field)
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
Expand Down

0 comments on commit f99bd0e

Please sign in to comment.