Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the term "renew" when using reload option!!! #170

Open
TarAll opened this issue Jul 30, 2016 · 5 comments
Open

Changing the term "renew" when using reload option!!! #170

TarAll opened this issue Jul 30, 2016 · 5 comments

Comments

@TarAll
Copy link

TarAll commented Jul 30, 2016

can i Put captcha field and captcha renew link at the same row ??
And how can i change the term "renew" to an icon??

@Gregwar
Copy link
Owner

Gregwar commented Aug 5, 2016

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

@Gregwar
Copy link
Owner

Gregwar commented Aug 5, 2016

Thus, you can redefine the captcha_widget block and put your own customization in it

@Gregwar
Copy link
Owner

Gregwar commented Aug 5, 2016

If you do an example it could be added in the README

@platinumgroupmedia
Copy link

platinumgroupmedia commented Sep 21, 2016

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.

@platinumgroupmedia
Copy link

platinumgroupmedia commented Sep 22, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants