Minor. keyField -> keyFrom

This commit is contained in:
Sam Georges 2014-09-17 19:49:42 +10:00
parent c8f3c640b8
commit 4f00fbdbc6
3 changed files with 9 additions and 7 deletions

View File

@ -44,7 +44,7 @@ class RecordFinder extends FormWidgetBase
/** /**
* @var string Field name to use for key. * @var string Field name to use for key.
*/ */
public $keyField = 'id'; public $keyFrom = 'id';
/** /**
* @var string Relation column to display for the name * @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->relationType = $this->model->getRelationType($this->relationName);
$this->prompt = $this->getConfig('prompt', 'Click the %s button to find a record'); $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->nameFrom = $this->getConfig('nameFrom', $this->nameFrom);
$this->descriptionFrom = $this->getConfig('descriptionFrom', $this->descriptionFrom); $this->descriptionFrom = $this->getConfig('descriptionFrom', $this->descriptionFrom);
@ -165,7 +165,7 @@ class RecordFinder extends FormWidgetBase
if (!$this->relationModel) if (!$this->relationModel)
return null; return null;
return $this->relationModel->{$this->keyField}; return $this->relationModel->{$this->keyFrom};
} }
public function getNameValue() public function getNameValue()

View File

@ -242,8 +242,9 @@ class Form extends WidgetBase
$this->model->fill($data); $this->model->fill($data);
$this->data = (object) array_merge((array) $this->data, (array) $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); $field->value = $this->getFieldValue($field);
}
return $data; return $data;
} }

View File

@ -23,7 +23,7 @@ class Components extends FormWidgetBase
{ {
$components = $this->listComponents(); $components = $this->listComponents();
return $this->makePartial('formcomponents', ['components'=>$components]); return $this->makePartial('formcomponents', ['components' => $components]);
} }
protected function listComponents() protected function listComponents()
@ -35,7 +35,7 @@ class Components extends FormWidgetBase
$manager = ComponentManager::instance(); $manager = ComponentManager::instance();
$manager->listComponents(); $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]; list($name, $alias) = strpos($name, ' ') ? explode(' ', $name) : [$name, $name];
try { try {
@ -50,7 +50,8 @@ class Components extends FormWidgetBase
if (isset($pluginDetails['icon'])) if (isset($pluginDetails['icon']))
$componentObj->pluginIcon = $pluginDetails['icon']; $componentObj->pluginIcon = $pluginDetails['icon'];
} }
} catch (Exception $ex) { }
catch (Exception $ex) {
$componentObj = new UnknownComponent(null, $properties, $ex->getMessage()); $componentObj = new UnknownComponent(null, $properties, $ex->getMessage());
$componentObj->alias = $alias; $componentObj->alias = $alias;
$componentObj->pluginIcon = 'icon-bug'; $componentObj->pluginIcon = 'icon-bug';