Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Proper handling of empty fields with BelongsTo

  • Loading branch information...
commit 25ad35fca09924a9581007206d15295fcefeaaf6 1 parent 9a09a36
@shadowhand shadowhand authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 classes/sprig/field/belongsto.php
View
5 classes/sprig/field/belongsto.php
@@ -10,6 +10,11 @@ public function input($name, $value, array $attr = NULL)
$choices = $model->select_list($model->pk());
+ if ($this->empty)
+ {
+ Arr::unshift($choices, '', '-- '.__('None'));
+ }
+
return Form::select($name, $choices, $this->verbose($value), $attr);
}
Please sign in to comment.
Something went wrong with that request. Please try again.