Merge remote-tracking branch 'laravel/develop' into develop
Conflicts: laravel/form.php
This commit is contained in:
@@ -7,7 +7,26 @@ class Form {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $labels = array();
|
||||
public static $labels = array();
|
||||
|
||||
/**
|
||||
* The registered custom macros.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $macros = array();
|
||||
|
||||
/**
|
||||
* Registers a custom macro.
|
||||
*
|
||||
* @param string $name
|
||||
* @param Closure $input
|
||||
* @return void
|
||||
*/
|
||||
public static function macro($name, $macro)
|
||||
{
|
||||
static::$macros[$name] = $macro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a HTML form.
|
||||
@@ -52,8 +71,7 @@ class Form {
|
||||
|
||||
// Since PUT and DELETE methods are not actually supported by HTML forms,
|
||||
// we'll create a hidden input element that contains the request method
|
||||
// and set the actual request method to POST. Laravel will look for the
|
||||
// hidden element to determine the request method.
|
||||
// and set the actual request method variable to POST.
|
||||
if ($method == 'PUT' or $method == 'DELETE')
|
||||
{
|
||||
$append = static::hidden(Request::spoofer, $method);
|
||||
@@ -541,8 +559,7 @@ class Form {
|
||||
{
|
||||
// If an ID has been explicitly specified in the attributes, we will
|
||||
// use that ID. Otherwise, we will look for an ID in the array of
|
||||
// label names as this makes it convenient to give input elements
|
||||
// the same ID as their corresponding labels.
|
||||
// label names so labels and their elements have the same ID.
|
||||
if (array_key_exists('id', $attributes))
|
||||
{
|
||||
return $attributes['id'];
|
||||
@@ -554,4 +571,21 @@ class Form {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle calls to custom macros.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public static function __callStatic($method, $parameters)
|
||||
{
|
||||
if (isset(static::$macros[$method]))
|
||||
{
|
||||
return call_user_func_array(static::$macros[$method], $parameters);
|
||||
}
|
||||
|
||||
throw new \Exception("Method [$method] does not exist.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user