PHP code example of thelia / customer-birth-date-module
1. Go to this page and download the library: Download thelia/customer-birth-date-module library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thelia / customer-birth-date-module example snippets
use CustomerBirthDate\Service\BirthdayDateService;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\TheliaFormEvent;
#[AsEventListener(event: TheliaEvents::FORM_AFTER_BUILD.'.name_of_form')]
class AddBirthDateToCustomerForm
{
public function __invoke(TheliaFormEvent $event): void
{
BirthdayDateService::apply($event);
}
}
public function __invoke(TheliaFormEvent $event): void
{
BirthdayDateService::apply($event, [
'attr' => [
'class' => 'BirthdateField flex gap-2',
],
// any other option supported by DateType
]);
}