allow passing of route options and action options in form::open.
This commit is contained in:
1 parent
a0706cc629
commit
aaa4148a1f
1 file changed
+34
-2
+34
-2
@@ -534,7 +534,7 @@ class FormBuilder {
|
|||||||
|
|
||||||
if (isset($options['route']))
|
if (isset($options['route']))
|
||||||
{
|
{
|
||||||
return $this->url->route($options['route']);
|
return $this->getRouteAction($options['route']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an action is available, we are attempting to open a form to a controller
|
// If an action is available, we are attempting to open a form to a controller
|
||||||
@@ -542,12 +542,44 @@ class FormBuilder {
|
|||||||
// actions and return them from the method. Otherwise, we'll use current.
|
// actions and return them from the method. Otherwise, we'll use current.
|
||||||
elseif (isset($options['action']))
|
elseif (isset($options['action']))
|
||||||
{
|
{
|
||||||
return $this->url->action($options['action']);
|
return $this->getControllerAction($options['action']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->url->current();
|
return $this->url->current();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the action for a "route" option.
|
||||||
|
*
|
||||||
|
* @param array|string $options
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getRouteAction($options)
|
||||||
|
{
|
||||||
|
if (is_array($options))
|
||||||
|
{
|
||||||
|
return $this->url->route($options[0], array_slice($options, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->url->route($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the action for an "action" option.
|
||||||
|
*
|
||||||
|
* @param array|string $options
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getControllerAction($options)
|
||||||
|
{
|
||||||
|
if (is_array($options))
|
||||||
|
{
|
||||||
|
return $this->url->action($options[0], array_slice($options, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->url->action($options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the form appendage for the given method.
|
* Get the form appendage for the given method.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in new issue
Block a user