Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature Request: actionInput template helper function #3566

Closed
AugustMiller opened this issue Dec 17, 2018 · 1 comment
Closed

Feature Request: actionInput template helper function #3566

AugustMiller opened this issue Dec 17, 2018 · 1 comment

Comments

@AugustMiller
Copy link
Contributor

AugustMiller commented Dec 17, 2018

Description

It'd be lovely to be able to generate the hidden input element for form actions… We already have shortcuts for csrfInput() and redirectInput(), so this feels like a handy addition.

Effectively, thinking something like this:

    // new \Twig_SimpleFunction('actionInput', [$this, 'actionInputFunction'])

    // ...

    /**
     * Returns an action input wrapped in a \Twig_Markup object.
     *
     * @return \Twig_Markup|null
     */
    public function actionInputFunction($actionPath)
    {
        return TemplateHelper::raw('<input type="hidden" name="action" value="' . $actionPath . '">');
    }

(I wasn't sure whether the name of the field depends on the actionTrigger setting?)

Happy to issue a PR—but wanted to make sure I wasn't missing something that's already available!

@brandonkelly
Copy link
Member

Sure, we’d accept the PR. docs/dev/functions.md would need to be updated as well.

(I wasn't sure whether the name of the field depends on the actionTrigger setting?)

Nope, that only applies to query string action params.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants