cntlscrut/drupal-eca-news-workflow

Complete automated editorial workflow system for news organizations using ECA (Event Condition Action)

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:drupal-recipe

pkg:composer/cntlscrut/drupal-eca-news-workflow

v1.0.2 2025-06-11 20:39 UTC

This package is auto-updated.

Last update: 2025-12-17 23:06:23 UTC


README

Editorial Workflow ECA Version

A comprehensive automated editorial workflow system built with ECA (Event Condition Action) for news organizations, magazines, and content-driven websites using Drupal.

πŸš€ Features

πŸ“ Editorial Workflow

  • Three-State Process: Draft β†’ In Review β†’ Published
  • Bidirectional Editing: Content can move back and forth between Draft and In Review
  • Smart Transitions: Automatic validation and checks during state changes
  • Bulk Operations: Manage multiple articles efficiently
  • Content Scheduling: Plan publication dates and times

πŸ“§ Intelligent Notifications

  • Role-Based Alerts: Targeted notifications based on user roles
  • Author Updates: Real-time feedback on content status
  • Editor Assignments: Automatic notification of pending reviews
  • Publication Alerts: Stakeholder updates on published content
  • Customizable Templates: Personalize notification messages

πŸ“Š Monitoring & Analytics

  • Activity Logging: Complete audit trail of all editorial actions
  • Performance Metrics: Track editorial efficiency
  • User Analytics: Monitor team productivity
  • Content Analytics: Publication success metrics
  • Workflow Optimization: Data-driven process improvements

⚑ Automation Engine

  • Content Validation: Automatic quality checks
  • SEO Compliance: Built-in optimization checks
  • Category Assignment: Smart content categorization
  • Publication Automation: Scheduled publishing
  • Workflow Rules: Customizable business logic

πŸ› οΈ Installation

Prerequisites

  • Drupal 11.0+
  • ECA module 2.1+
  • Content Moderation module
  • PHP 8.1+

Quick Install

# Using Drupal's recipe system
drush recipe recipes/news_editorial_workflow

# Or install manually
drush en eca_base eca_content eca_log eca_workflow content_moderation workflows
drush cim --partial --source=recipes/news_editorial_workflow/config

Composer Installation

# If installing from a repository
composer require drupal/news_editorial_workflow_recipe
drush recipe news_editorial_workflow

πŸ“– Usage

1. Basic Workflow

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

2. Customizing Notifications

Edit the ECA model to customize notification behavior:

# In eca.eca.news_editorial_workflow.yml
events:
  content_moderation_state_change:
    conditions:
      - workflow_id: basic_editorial
      - from_state: draft
      - to_state: in_review
    actions:
      - send_email:
          to: '[node:author:mail]'
          subject: 'Article submitted for review'

3. Adding Custom States

Extend the workflow by adding new states:

# In workflows.workflow.basic_editorial.yml
type_settings:
  states:
    fact_check:
      label: 'Fact Check'
      weight: 3
  transitions:
    fact_check_to_review:
      from: [fact_check]
      to: in_review

πŸ—οΈ Architecture

ECA Model Structure

News Editorial Workflow
β”œβ”€β”€ Content Events
β”‚   β”œβ”€β”€ State Change Triggers
β”‚   β”œβ”€β”€ User Action Events
β”‚   └── Scheduled Events
β”œβ”€β”€ Conditions
β”‚   β”œβ”€β”€ Role Checks
β”‚   β”œβ”€β”€ Content Validation
β”‚   └── Business Rules
└── Actions
    β”œβ”€β”€ Email Notifications
    β”œβ”€β”€ User Messages
    β”œβ”€β”€ Logging
    └── Content Operations

State Machine

graph LR
    A[Draft] -->|Submit| B[In Review]
    B -->|Approve| C[Published]
    B -->|Reject| A
    C -->|Unpublish| D[Unpublished]
    D -->|Republish| C
Loading

🎨 Customization

Adding New Roles

  1. Create new role: drush role:create fact_checker "Fact Checker"
  2. Update ECA conditions to include new role
  3. Modify notification templates

Custom Email Templates

email_templates:
  submission_notification:
    subject: '[site:name] - Article Submitted: [node:title]'
    body: |
      Dear Editor,
      
      A new article has been submitted for review:
      Title: [node:title]
      Author: [node:author:display-name]
      
      Review at: [node:url]

Integration Examples

With Views Bulk Operations

# Custom VBO action for bulk state changes
views_bulk_operations:
  actions:
    bulk_moderate_content:
      plugin_id: node_moderation_action
      configuration:
        state: published

With Scheduler Integration

# Automatic publication scheduling
scheduler_integration:
  publish_on: '[node:field_publish_date:value]'
  unpublish_on: '[node:field_unpublish_date:value]'

πŸ§ͺ Testing

Running Tests

# Unit tests
phpunit --group news_editorial_workflow

# Functional tests
drush test-run --group EditorialWorkflow

# Behat scenarios
behat features/editorial-workflow.feature

Test Scenarios Included

  • βœ… Basic state transitions
  • βœ… Role-based permissions
  • βœ… Email notification delivery
  • βœ… Bulk operations
  • βœ… Content validation
  • βœ… Performance under load

πŸ”§ Configuration

Environment Variables

# Email configuration
EDITORIAL_SMTP_HOST=smtp.example.com
EDITORIAL_FROM_EMAIL=editorial@example.com

# Notification settings
EDITORIAL_ENABLE_SLACK=true
EDITORIAL_SLACK_WEBHOOK=https://hooks.slack.com/...

Configuration Files

  • workflows.workflow.basic_editorial.yml - Workflow definition
  • eca.eca.news_editorial_workflow.yml - ECA configuration
  • eca.model.news_editorial_workflow.yml - ECA model definition

πŸ“š Examples

1. News Website Setup

Perfect for online newspapers with multiple reporters and editors:

drush recipe news_editorial_workflow
drush role:create reporter "Reporter"
drush role:create editor "Editor"
drush role:create publisher "Publisher"

2. Magazine Integration

Ideal for monthly/weekly magazines with longer review cycles:

# Extended review process
workflow_modifications:
  additional_states:
    - copy_edit
    - fact_check
    - legal_review

3. Corporate Blog

Streamlined workflow for corporate content:

# Simplified two-state workflow
simple_workflow:
  states: [draft, published]
  auto_publish: true

🀝 Contributing

We welcome contributions! Here's how to get involved:

Development Setup

git clone https://github.com/your-org/news-editorial-workflow-recipe.git
cd news-editorial-workflow-recipe
composer install
ddev start

Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Standards

  • Follow Drupal coding standards
  • Write comprehensive tests
  • Document all changes
  • Update README as needed

πŸ“„ License

This project is licensed under the GPL-2.0+ License - see the LICENSE file for details.

πŸ†˜ Support

πŸŽ–οΈ Credits

  • Built with ❀️ by the ECA Team
  • Inspired by real-world newsroom workflows
  • Community contributions from editorial professionals

πŸ—ΊοΈ Roadmap

Version 1.1 (Planned)

  • AI-powered content suggestions
  • Advanced analytics dashboard
  • Multi-site workflow synchronization
  • Mobile editorial app integration

Version 1.2 (Future)

  • Video/multimedia workflow support
  • Social media integration
  • Real-time collaborative editing
  • Advanced permission granularity

Made with ❀️ for the Drupal Community

Drupal ECA Community