Skip to content

Commit

Permalink
Fix used $boltforms_config
Browse files Browse the repository at this point in the history
  • Loading branch information
bobdenotter committed Oct 27, 2020
1 parent d5ac94b commit 417bbcf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/FormRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,16 @@ public function run(string $formName = '', bool $warn = true)
$template = $config->get('templates')['form'];

return $this->twig->render($template, [
'formconfig' => $formConfig,
'boltforms_config' => $config,
'form_config' => $formConfig,
'debug' => $config->get('debug'),
'honeypotname' => $honeypotName,
'honeypot_name' => $honeypotName,
'form' => $form->createView(),
'submitted' => $form->isSubmitted(),
'valid' => $form->isSubmitted() && $form->isValid(),
'data' => $form->getData(),
'formconfig' => $formConfig, // Deprecated
'honeypotname' => $honeypotName, // Deprecated
]);
}
}
8 changes: 4 additions & 4 deletions templates/form.html.twig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{# this tag only applies to the forms defined in this template #}
{% set layout = config.layout.form|default('form_div_layout.html.twig') %}
{% set layout = boltforms_config.layout.form|default('form_div_layout.html.twig') %}
{% form_theme form layout %}

{% if config.layout.bootstrap|default() %}
{% if boltforms_config.layout.bootstrap|default() %}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
{% endif %}

Expand All @@ -23,8 +23,8 @@
{% endif %}

{% if not valid %}
{% include '@boltforms/honeypotstyle.html.twig' with {'honeypotname': honeypotname} %}
{% include '@boltforms/honeypotstyle.html.twig' with {'honeypot_name': honeypot_name} %}
{{ form(form) }}
{% endif %}

<hr>
<hr>
4 changes: 2 additions & 2 deletions templates/honeypotstyle.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if honeypotname %}
{% if honeypot_name %}
<script>
var getClosest = function (elem, selector) {
for ( ; elem && elem !== document; elem = elem.parentNode ) {
Expand All @@ -8,7 +8,7 @@
};
document.addEventListener("DOMContentLoaded", function() {
var el = getClosest(document.querySelector("#{{ honeypotname }}"), 'div');
var el = getClosest(document.querySelector("#{{ honeypot_name }}"), 'div');
el.style.position = 'absolute';
el.style.top = '3px';
el.style.left = '-6600px';
Expand Down

0 comments on commit 417bbcf

Please sign in to comment.