Open TarAll opened 8 years ago
To do this, you will have to customize twig templates There is documentation about this: http://symfony.com/doc/current/form/form_customization.html
And the captcha widget template is defined here: https://github.com/Gregwar/CaptchaBundle/blob/master/Resources/views/captcha.html.twig
Thus, you can redefine the captcha_widget
block and put your own customization in it
If you do an example it could be added in the README
In your app, create a folder structure in your bundle as follows: app/Resources/GregwarCaptchaBundle/views. Inside create a file called "captcha.html.twig". Copy the contents of /vendor/gregwar/captcha-bundle/Resources/views/captcha.html.twig into that file and modify the contents to get your items on the same line. Your view will override the bundle view. This is all assuming you are using version 2.*+ of the captcha bundle. Not sure about older versions of Symfony.
What eventually ended up working for us is to view the source of the page and find out what the "id" attribute of the captcha input box is and then either add css styles at the top of your page or modify your css files. Ours was called "contact_captcha"
<input type="text" id="contact_captcha" name="contact[captcha]" required="required" class="form-control" style="margin-left: 10px;" />
Then we modified our css file and added:
input#contact_captcha { width: 100px; float: right; margin-top: 8px; margin-right: 100px; }
Overriding the template as I explained above gave us the added ability to get rid of the "Reload" text and add a font-awesome icon instead:
<a class="captcha_reload" href="javascript:reload_{{ image_id }}();" style="margin-top:10px;"><i class="fa-lg fa fa-refresh" aria-hidden="true"></i></a>
Hope all this helps.
can i Put captcha field and captcha renew link at the same row ?? And how can i change the term "renew" to an icon??