Skip to content

Instantly share code, notes, and snippets.

@LukeTowers
Created February 4, 2017 03:40
Show Gist options
  • Save LukeTowers/1c76e84450509ee1547ca41b9b444225 to your computer and use it in GitHub Desktop.
Save LukeTowers/1c76e84450509ee1547ca41b9b444225 to your computer and use it in GitHub Desktop.
OctoberCMS Snippets
==
<?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