PHP code example of markocupic / calendar-event-booking-bundle

1. Go to this page and download the library: Download markocupic/calendar-event-booking-bundle 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/ */

    

markocupic / calendar-event-booking-bundle example snippets



// Put this in TL_ROOT/contao/dca/tl_calendar_events_member.php

use Contao\CoreBundle\DataContainer\PaletteManipulator;

// Add additional field to tl_calendar_events_member
$GLOBALS['TL_DCA']['tl_calendar_events_member']['fields']['foodHabilities'] = [
    'exclude'   => true,
    'search'    => true,
    'sorting'   => true,
    'inputType' => 'select',
    'options'   => ['vegetarian', 'vegan'],
    'eval'      => ['


// src/EventListener/DoSomething.php

declare(strict_types=1);

namespace App\EventListener;

use Markocupic\CalendarEventBookingBundle\Controller\FrontendModule\CalendarEventBookingEventBookingModuleController;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;

 #[AsHook(DoSomething::HOOK, priority: 1200)]
final class DoSomething
{
    public const HOOK = 'calEvtBookingPostBooking';

    /**
     * @var EventRegistration
     */
    private $eventRegistration;

    public function __invoke(CalendarEventBookingEventBookingModuleController $moduleInstance, array $arrDisabledHooks = []): void
    {
        if (\in_array(self::class, $arrDisabledHooks, true)) {
            return;
        }

        $event = $moduleInstance->getEvent();
        $registration = $moduleInstance->getEventRegistration();
        $form = $moduleInstance->getForm();

        // Do something

    }
}