numero2 / contao-churchdesk

Import news and events from ChurchDesk as news into Contao.
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Contao ChurchDesk Bundle

License: LGPL v3

About

Import news and events from ChurchDesk as news into Contao.

System requirements

Installation

Configuration

Hooks

By default the bundle only imports certain information from ChurchDesk. If you need more data you can import them on your own using the parseChurchDeskEntry hook:

// 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;
        }
    }
}

Console Commands

An automatic import of all events and blog entries can be started via the command vendor/bin/contao-console contao:churchdesk:import.