PHP code example of numero2 / contao-churchdesk

1. Go to this page and download the library: Download numero2/contao-churchdesk 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/ */

    

numero2 / contao-churchdesk example snippets


// src/EventListener/ParseChurchDeskEntryListener.php
namespace App\EventListener;

use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\Model;
use Contao\NewsModel;
use Contao\CalendarEventsModel;

/**
 * @Hook("parseChurchDeskEntry")
 */
class ParseChurchDeskEntryListener {
    
    public function __invoke( Model $model, array $apiData, bool $isUpdate ): void {

        if( $model instanceof CalendarEventsModel ) {
            $model->something = $apiData->something;
        }

        if( $model instanceof NewsModel ) {
            $model->anything = $apiData->anything;
        }
    }
}