numero2/contao-churchdesk

Import news and events from ChurchDesk into Contao

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

Type:contao-bundle

1.0.0 2024-01-25 07:27 UTC

This package is auto-updated.

Last update: 2024-03-29 12:28:44 UTC


README

License: LGPL v3

About

Import news and events from ChurchDesk as news into Contao.

System requirements

Installation

  • Install via Contao Manager or Composer (composer require numero2/contao-churchdesk)
  • Run a database update via the Contao-Installtool or using the contao:migrate command.

Configuration

  • Enter credentials in the config.yaml
    church_desk:
        api:
            organization_id: 123
            partner_token: 'abc'
  • Configure the event calendar and or news archive

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.