We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e3f266 commit 4f6ae1dCopy full SHA for 4f6ae1d
src/Form.php
@@ -63,7 +63,12 @@ public function build($field_name = null, $overrides = []) {
63
if ($this->model->fieldType($field_name) == 'reference') {
64
// Get list of possible results
65
$refmodel = $this->model->refModel($field_name);
66
- $options = $refmodel::find_pairs_representation();
+ $options = $refmodel::defaultFilter()->find_pairs_representation();
67
+ if (!array_key_exists($this->model->$field_name, $options)) {
68
+ foreach ($refmodel::where_id($this->model->$field_name)->find_pairs_representation() as $id => $representation) {
69
+ $options[$id] = $representation;
70
+ }
71
72
}
73
if ($this->model->fieldType($field_name) == 'enum') {
74
$options = $this->model->enum_options($field_name);
0 commit comments