PHP code example of cntlscrut / drupal-eca-news-workflow
1. Go to this page and download the library: Download cntlscrut/drupal-eca-news-workflow 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/ */
cntlscrut / drupal-eca-news-workflow example snippets
// Content starts in Draft state
$node = Node::create([
'type' => 'news',
'title' => 'Breaking News Article',
'moderation_state' => 'draft',
]);
$node->save();
// Submit for review
$node->set('moderation_state', 'in_review');
$node->save(); // Triggers notification to editors
// Publish content
$node->set('moderation_state', 'published');
$node->save(); // Triggers publication notifications