Skip to content

Commit

Permalink
Don't force parsley property to be initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
happyDemon committed Jul 2, 2015
1 parent 23cdc03 commit a0e8f4c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/HappyDemon/LaravelParsley/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public function helpBlock($value, array $options = [])
*/
public function input($type, $name, $value = null, $options = [])
{
$options = array_merge($options, $this->parsley->getFieldRules($name));
if($this->parsley != null)
$options = array_merge($options, $this->parsley->getFieldRules($name));

return parent::input($type, $name, $value, $options);
}
Expand All @@ -89,14 +90,16 @@ public function input($type, $name, $value = null, $options = [])
*/
public function textarea($name, $value = null, $options = [])
{
$options = array_merge($options, $this->parsley->getFieldRules($name));
if($this->parsley != null)
$options = array_merge($options, $this->parsley->getFieldRules($name));

return parent::textarea($name, $value, $options);
}

public function select($name, $list = [], $selected = null, $options = [])
{
$options = array_merge($options, $this->parsley->getFieldRules($name));
if($this->parsley != null)
$options = array_merge($options, $this->parsley->getFieldRules($name));

return parent::select($name, $list, $selected, $options);
}
Expand Down

0 comments on commit a0e8f4c

Please sign in to comment.