Skip to content

Commit

Permalink
Added ability to set template: in form
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Mar 17, 2017
1 parent 47b80ad commit 3b8edc4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions form.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ protected function process($form)
}
}
}

// Set page template if passed by form
if (isset($form->template)) {
$this->grav['page']->template($form->template);
}
}

/**
Expand Down
7 changes: 7 additions & 0 deletions templates/form-messages.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if form.message %}
{% if form.inline_errors and form.messages %}
<div class="alert notices {{ form.message_color ?: 'green' }}"><p>{{ "FORM.VALIDATION_FAIL"|t|raw }}</p></div>
{% else %}
<div class="alert notices {{ form.message_color ?: 'green' }}"><p>{{ form.message|raw }}</p></div>
{% endif %}
{% endif %}

0 comments on commit 3b8edc4

Please sign in to comment.