From 4f00fbdbc6edf05594cf08c44c789e904052f6b7 Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Wed, 17 Sep 2014 19:49:42 +1000 Subject: [PATCH] Minor. keyField -> keyFrom --- modules/backend/formwidgets/RecordFinder.php | 6 +++--- modules/backend/widgets/Form.php | 3 ++- modules/cms/formwidgets/Components.php | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/backend/formwidgets/RecordFinder.php b/modules/backend/formwidgets/RecordFinder.php index 72b62ea64..314f41afa 100644 --- a/modules/backend/formwidgets/RecordFinder.php +++ b/modules/backend/formwidgets/RecordFinder.php @@ -44,7 +44,7 @@ class RecordFinder extends FormWidgetBase /** * @var string Field name to use for key. */ - public $keyField = 'id'; + public $keyFrom = 'id'; /** * @var string Relation column to display for the name @@ -80,7 +80,7 @@ class RecordFinder extends FormWidgetBase $this->relationType = $this->model->getRelationType($this->relationName); $this->prompt = $this->getConfig('prompt', 'Click the %s button to find a record'); - $this->keyField = $this->getConfig('keyField', $this->keyField); + $this->keyFrom = $this->getConfig('keyFrom', $this->keyFrom); $this->nameFrom = $this->getConfig('nameFrom', $this->nameFrom); $this->descriptionFrom = $this->getConfig('descriptionFrom', $this->descriptionFrom); @@ -165,7 +165,7 @@ class RecordFinder extends FormWidgetBase if (!$this->relationModel) return null; - return $this->relationModel->{$this->keyField}; + return $this->relationModel->{$this->keyFrom}; } public function getNameValue() diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index 430e5afcc..9b44c4b35 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -242,8 +242,9 @@ class Form extends WidgetBase $this->model->fill($data); $this->data = (object) array_merge((array) $this->data, (array) $data); - foreach ($this->fields as $field) + foreach ($this->fields as $field) { $field->value = $this->getFieldValue($field); + } return $data; } diff --git a/modules/cms/formwidgets/Components.php b/modules/cms/formwidgets/Components.php index b52df6785..a3f6014c0 100644 --- a/modules/cms/formwidgets/Components.php +++ b/modules/cms/formwidgets/Components.php @@ -23,7 +23,7 @@ class Components extends FormWidgetBase { $components = $this->listComponents(); - return $this->makePartial('formcomponents', ['components'=>$components]); + return $this->makePartial('formcomponents', ['components' => $components]); } protected function listComponents() @@ -35,7 +35,7 @@ class Components extends FormWidgetBase $manager = ComponentManager::instance(); $manager->listComponents(); - foreach ($this->model->settings['components'] as $name=>$properties) { + foreach ($this->model->settings['components'] as $name => $properties) { list($name, $alias) = strpos($name, ' ') ? explode(' ', $name) : [$name, $name]; try { @@ -50,7 +50,8 @@ class Components extends FormWidgetBase if (isset($pluginDetails['icon'])) $componentObj->pluginIcon = $pluginDetails['icon']; } - } catch (Exception $ex) { + } + catch (Exception $ex) { $componentObj = new UnknownComponent(null, $properties, $ex->getMessage()); $componentObj->alias = $alias; $componentObj->pluginIcon = 'icon-bug';