Skip to content
Permalink
Browse files

adds functionality to include options and change the method type for …

…the automatically created form
  • Loading branch information...
TheFRedFox committed Apr 13, 2016
1 parent 445e0cc commit dcd7f886d6404e174c51625b75bb4cac6b8b8919
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/View/Helper/FormHelper.php
@@ -1616,7 +1616,16 @@ public function button($title, array $options = [])
*/
public function postButton($title, $url, array $options = [])
{
$out = $this->create(false, ['url' => $url]);
$formOptions = ['url' => $url];
if (isset($options['method'])) {
$formOptions['type'] = $options['method'];
unset($options['method']);
}
if (isset($options['form']) && is_array($options['form'])) {
$formOptions = $options['form'] + $formOptions;
unset($options['form']);
}
$out = $this->create(false, $formOptions);
if (isset($options['data']) && is_array($options['data'])) {
foreach (Hash::flatten($options['data']) as $key => $value) {
$out .= $this->hidden($key, ['value' => $value]);

0 comments on commit dcd7f88

Please sign in to comment.
You can’t perform that action at this time.