Skip to content

Commit

Permalink
Reverted change that makes mandatory to edit the project's services.y…
Browse files Browse the repository at this point in the history
…aml to the user of the library
  • Loading branch information
carlos-mg89 committed Dec 9, 2020
1 parent e3950e2 commit dbe25f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ Simply run `composer require carlos-mg89/symfony-captcha-bundle`
],
];
```
4. Edit your `FormType` or your `FormBuilderInterface` with this bit that adds the captcha along with the constraing to validate the form:
4. Edit your `config/services.yaml` so it autowires the controllers used in the library:
```
# We need to autowire the Container (or manually wire it)
services:
Captcha\Bundle\CaptchaBundle\Controller\:
resource: '../vendor/carlos-mg89/symfony-captcha-bundle/Controller'
autowire: true
```
5. Edit your `FormType` or your `FormBuilderInterface` with this bit that adds the captcha along with the constraing to validate the form:
```
$builder->add('captchaCode', CaptchaType::class, [
'captchaConfig' => 'ExampleCaptcha',
Expand All @@ -69,12 +77,12 @@ Simply run `composer require carlos-mg89/symfony-captcha-bundle`
]
]);
```
5. Now edit your Twig template with the new `captchaCode` (`CaptchaType`):
6. Now edit your Twig template with the new `captchaCode` (`CaptchaType`):
```
{{ form_label(form.captchaCode) }}
{{ form_widget(form.captchaCode}) }}
```
6. Finally, add the Form validation:
7. Finally, add the Form validation:
```
$contactForm = $this->createForm(ContactType::class);
$contactForm->handleRequest($request);
Expand Down
9 changes: 2 additions & 7 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
public: true
arguments:
- '@service_container'

simple_captcha:
class: '%botdetect_simple_captcha.class%'
public: true
Expand Down Expand Up @@ -60,9 +60,4 @@ services:
arguments:
- '@service_container'
tags:
- { name: validator.constraint_validator, alias: valid_simple_captcha }

Captcha\Bundle\CaptchaBundle\Controller\:
resource: '../../Controller'
arguments:
- '@service_container'
- { name: validator.constraint_validator, alias: valid_simple_captcha }

0 comments on commit dbe25f4

Please sign in to comment.