Skip to content

Commit

Permalink
Updated code to match latest FormViewInterface changes
Browse files Browse the repository at this point in the history
  • Loading branch information
excelwebzone committed May 25, 2012
1 parent 2c3d7bc commit 9843afb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions Form/Type/RecaptchaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ public function buildView(FormViewInterface $view, FormInterface $form, array $o
$server = self::RECAPTCHA_API_SERVER;
}

$view->set('url_challenge', $server.'/challenge?k='.$this->publicKey);
$view->set('url_noscript', $server.'/noscript?k='.$this->publicKey);
$view->set('public_key', $this->publicKey);
$view->set('ewz_recaptcha_enabled', $this->enabled);
$view->addVars(array(
'url_challenge' => $server.'/challenge?k='.$this->publicKey,
'url_noscript' => $server.'/noscript?k='.$this->publicKey,
'public_key' => $this->publicKey,
'ewz_recaptcha_enabled' => $this->enabled,
));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Resources/views/Form/ewz_recaptcha_widget.html.twig
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% block ewz_recaptcha_widget %}
{% spaceless %}
{% if form.get('ewz_recaptcha_enabled') %}
{% if form.getVar('ewz_recaptcha_enabled') %}
{% if attr.options is defined %}
<script type="text/javascript">
var RecaptchaOptions = {{ attr.options|json_encode|raw }}
</script>
{% endif %}
<script src="{{ form.get('url_challenge') }}" type="text/javascript"></script>
<script src="{{ form.getVar('url_challenge') }}" type="text/javascript"></script>
<noscript>
<iframe src="{{ form.get('url_noscript') }}" height="300" width="500"></iframe><br/>
<iframe src="{{ form.getVar('url_noscript') }}" height="300" width="500"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>
Expand Down

0 comments on commit 9843afb

Please sign in to comment.