PHP code example of zeixcom / craft-delta

1. Go to this page and download the library: Download zeixcom/craft-delta 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/ */

    

zeixcom / craft-delta example snippets


use yii\base\Event;
use zeixcom\craftdelta\services\FieldDiffService;
use zeixcom\craftdelta\events\RegisterDiffersEvent;

Event::on(
    FieldDiffService::class,
    FieldDiffService::EVENT_REGISTER_DIFFERS,
    function (RegisterDiffersEvent $event) {
        $event->differs[\myvendor\fields\MyField::class] = MyFieldDiffer::class;
    }
);

'notifications' => ['submitted', 'published'],

// config/craft-delta.php
return [
    'emailTemplates' => [
        'submitted' => 'emails/delta/submitted',
        'approved'  => 'emails/delta/approved',
        'declined'  => 'emails/delta/declined',
        'published' => 'emails/delta/published',
        'comment'   => 'emails/delta/comment',
    ],
];

use yii\base\Event;
use zeixcom\craftdelta\services\WorkflowService;
use zeixcom\craftdelta\events\WorkflowEvent;

Event::on(
    WorkflowService::class,
    WorkflowService::EVENT_AFTER_PUBLISH,
    function (WorkflowEvent $event) {
        $review = $event->review; // zeixcom\craftdelta\models\Review
        // $review->state, $review->round, $review->canonicalEntryId, …
    }
);