Skip to content

Commit

Permalink
Add field config support for number and range, with min/max attribs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Mar 24, 2016
1 parent eca212c commit 119a7c3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public static function factory($name, array $field, array $values = null)
$captcha = (isset($field['captcha'])) ? $field['captcha'] : null;
$data = (isset($field['data'])) ? $field['data'] : null;
$multiple = (isset($field['multiple'])) ? $field['multiple'] : false;
$min = (isset($field['min'])) ? $field['min'] : false;
$max = (isset($field['max'])) ? $field['max'] : false;

if (isset($field['error'])) {
$error = [
Expand Down Expand Up @@ -149,6 +151,12 @@ public static function factory($name, array $field, array $values = null)
case 'datetime-local':
$elem = new Element\Input\DateTimeLocal($name, $value);
break;
case 'number':
$elem = new Element\Input\Number($name, $min, $max, $value);
break;
case 'range':
$elem = new Element\Input\Range($name, $min, $max, $value);
break;
default:
$class = 'Pop\\Form\\Element\\Input\\' . ucfirst(strtolower($type));
if (!class_exists($class)) {
Expand Down

0 comments on commit 119a7c3

Please sign in to comment.