PHP code example of janborg / contao-ical-bundle
1. Go to this page and download the library: Download janborg/contao-ical-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/ */
janborg / contao-ical-bundle example snippets
namespace App\EventListener;
use Janborg\ContaoIcal\Event\EditVeventEvent;
use Kigkonsult\Icalcreator\Vevent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
#[AsEventListener(event: EditVEventEvent::class)]
class EditVeventListener
{
public function __invoke(EditVeventEvent $event): Vevent
{
// Get the Vevent object and the CalendarEventsModel object from the event
$vevent = $event->getVevent();
$calendarEvent = $event->getCalendarEvent();
// Modify the Vevent object as needed
// return the modified Vevent object
return $vevent;
}
}
namespace App\EventListener;
use Contao\CalendarEventsModel;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Kigkonsult\Icalcreator\Vevent;
#[AsHook('editVEvent')]
class EditVEventListener
{
public function __invoke(Vevent $vEvent, CalendarEventsModel $objEvent): Vevent
{
// Add additional data or modify $vEvent …
return $vEvent;
}
}