Commit c18dcecb by Taylor Otwell

Merge pull request #420 from kyledecot/develop

Form::register
parents 43212f85 95ba416f
...@@ -10,6 +10,28 @@ class Form { ...@@ -10,6 +10,28 @@ class Form {
protected static $labels = array(); protected static $labels = array();
/** /**
* The registered custom inputs
*
* @var array
*/
protected static $inputs = array();
/**
* Dynamically handle calls to custom registered inputs.
*/
public static function __callStatic($method, $parameters)
{
if (isset(static::$inputs[$method]))
{
return call_user_func_array(static::$inputs[$method], $parameters);
}
throw new \Exception("Method [$method] does not exist.");
}
/**
* Open a HTML form. * Open a HTML form.
* *
* <code> * <code>
...@@ -63,6 +85,19 @@ class Form { ...@@ -63,6 +85,19 @@ class Form {
} }
/** /**
* Registers a custom input
*
* @param string $name
* @param Closure $input
* @return void
*/
public static function register($name, $input)
{
static::$inputs[$name] = $input;
}
/**
* Determine the appropriate request method to use for a form. * Determine the appropriate request method to use for a form.
* *
* @param string $method * @param string $method
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment