-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
545 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
flysystem: | ||
storages: | ||
form_builder.email_checker.storage: | ||
adapter: 'local' | ||
options: | ||
directory: '%kernel.project_dir%/var/tmp/form-builder-email-checker' | ||
|
||
form_builder: | ||
validation_constraints: | ||
email_checker: | ||
class: FormBuilderBundle\Validator\Constraints\EmailChecker | ||
label: 'form_builder_validation_constraint.email_checker' | ||
icon_class: form_builder_icon_validation |
16 changes: 16 additions & 0 deletions
16
config/optional/services/disposable_email_domain_checker.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
services: | ||
|
||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
public: false | ||
|
||
FormBuilderBundle\Validator\EmailChecker\DisposableEmailDomainChecker: | ||
tags: | ||
- { name: form_builder.validator.email_checker } | ||
|
||
FormBuilderBundle\Maintenance\DisposableEmailDomainFetchTask: | ||
arguments: | ||
$logger: '@form_builder.application_logger.email_checker_logger' | ||
tags: | ||
- {name: pimcore.maintenance.task, type: formbuilder_email_checker_disposable_email_domain_fetch } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
services: | ||
|
||
form_builder.application_logger.email_checker_logger: | ||
public: true | ||
class: Pimcore\Bundle\ApplicationLoggerBundle\ApplicationLogger | ||
calls: | ||
- [addWriter, ['@Pimcore\Bundle\ApplicationLoggerBundle\Handler\ApplicationLoggerDb']] | ||
- [setComponent, ['form_builder_email_checker']] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
services: | ||
|
||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
public: false | ||
|
||
FormBuilderBundle\Maintenance\CleanUpTask: | ||
tags: | ||
- {name: pimcore.maintenance.task, type: formbuilder_clean_up } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
namespace FormBuilderBundle\Event; | ||
|
||
use Symfony\Contracts\EventDispatcher\Event; | ||
use Symfony\Component\Form\FormInterface; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
abstract class BaseSubmissionEvent extends Event | ||
{ | ||
protected readonly Request $request; | ||
protected FormInterface $form; | ||
protected bool $useFlashBag; | ||
protected array $messages; | ||
|
||
protected ?string $locale = null; | ||
|
||
public function __construct( | ||
Request $request, | ||
FormInterface $form, | ||
bool $useFlashBag = true, | ||
array $messages = [] | ||
) { | ||
$this->request = $request; | ||
$this->form = $form; | ||
$this->useFlashBag = $useFlashBag; | ||
$this->messages = $messages; | ||
} | ||
|
||
public function getRequest(): Request | ||
{ | ||
return $this->request; | ||
} | ||
|
||
public function getForm(): FormInterface | ||
{ | ||
return $this->form; | ||
} | ||
|
||
public function useFlashBag(): bool | ||
{ | ||
return $this->useFlashBag; | ||
} | ||
|
||
public function getMessages(): array | ||
{ | ||
return $this->messages; | ||
} | ||
|
||
public function getMessagesOfType(string $type): array | ||
{ | ||
return $this->messages[$type] ?? []; | ||
} | ||
|
||
public function hasMessagesOfType(string $type): bool | ||
{ | ||
return array_key_exists($type, $this->messages); | ||
} | ||
|
||
public function addMessage(string $type, mixed $message): void | ||
{ | ||
if (empty($message)) { | ||
return; | ||
} | ||
|
||
if (!array_key_exists($type, $this->messages)) { | ||
$this->messages[$type] = []; | ||
} | ||
|
||
$this->messages[$type][] = $message; | ||
} | ||
|
||
public function getLocale(): ?string | ||
{ | ||
return $this->locale; | ||
} | ||
|
||
public function setLocale(?string $locale): void | ||
{ | ||
$this->locale = $locale; | ||
} | ||
} |
Oops, something went wrong.