Created
February 4, 2017 03:40
-
-
Save LukeTowers/1c76e84450509ee1547ca41b9b444225 to your computer and use it in GitHub Desktop.
OctoberCMS Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== | |
<?php | |
function onHandle() { | |
Flash::success('test'); | |
} | |
?> | |
== | |
{# Doesn't work because no 'data-request' or 'data-request-flash' is set on the containing form #} | |
{{ form_open() }} | |
<button type="submit" | |
data-request="onHandle" | |
data-request-flash | |
class="btn"> | |
No flash. | |
</button> | |
{{ form_close() }} | |
{# Does work when those attributes are set on the containing form to match the context checked for in the flash message display listening logic #} | |
{{ form_open({'data-request': true, 'data-request-flash': true}) }} | |
<button type="submit" | |
data-request="onHandle" | |
data-request-flash | |
class="btn"> | |
Flash | |
</button> | |
{{ form_close() }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment