bluefly/dita_ccms

DITA authoring and publishing framework for Drupal 10/11 with API-first approach and test-driven development.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Type:drupal-module

0.1.0 2025-09-03 16:29 UTC

README

Enterprise-grade DITA XML authoring and publishing framework for Drupal 10/11.

DESCRIPTION

The DITA CCMS module provides comprehensive DITA (Darwin Information Typing Architecture) content management capabilities for Drupal, enabling technical documentation teams to author, manage, and publish structured content using industry-standard DITA XML format.

This module leverages existing Drupal contrib modules (ECK, Feeds, Workflows) rather than reinventing functionality, following the Drupal principle of "There's a module for that!"

REQUIREMENTS

  • Drupal 10.3 or 11
  • PHP 8.1+
  • Required modules:
    • Entity Construction Kit (ECK) ^2.0
    • Content Moderation
    • Workflows
    • Feeds ^3.0
    • REST
    • Serialization
    • Views
    • Views Data Export
    • Field Group

INSTALLATION

Using Composer (Recommended)

composer require drupal/dita_ccms
drush en dita_ccms -y

Manual Installation

  1. Download and extract to modules/custom/
  2. Enable the module:
    drush en dita_ccms -y
    
  3. Configure at /admin/config/content/dita-ccms

CONFIGURATION

Initial Setup

  1. Configure DITA Topic Types

    • Navigate to /admin/structure/dita-topic-types
    • Default types: Topic, Task, Concept, Reference
    • Add custom topic types as needed
  2. Set Up Workflows

    • Navigate to /admin/config/workflow/workflows/manage/dita_editorial
    • Configure states: Draft, Review, Published, Archived
    • Assign permissions to roles
  3. Configure Import/Export

    • Navigate to /admin/config/content/dita-ccms/import-export
    • Set default export formats
    • Configure DITA-OT integration (if available)
  4. API Configuration

    • Enable REST endpoints at /admin/config/services/rest
    • Configure authentication methods
    • Set rate limiting (recommended)

FEATURES

Content Management

  • DITA Topic Management: Create and manage DITA topics using ECK entities
  • DITA Map Support: Organize topics into maps for structured documentation
  • Topic Types: Support for standard DITA topic types (concept, task, reference, topic)
  • Metadata Management: Comprehensive metadata fields (audience, keywords, status)

Import/Export

  • XML Import: Import existing DITA XML content via Feeds module
  • Multiple Export Formats: Export to DITA XML, HTML, PDF, EPUB, Markdown
  • Batch Processing: Queue-based processing for large documentation sets
  • DITA-OT Integration: Optional integration with DITA Open Toolkit

Workflow & Publishing

  • Editorial Workflow: Content moderation with configurable states
  • Publishing Queue: Asynchronous publishing with progress tracking
  • Version Control: Track content changes and revisions
  • Access Control: Granular permissions for viewing, editing, and publishing

API & Integration

  • RESTful API: Full CRUD operations via REST endpoints
  • GraphQL Support: Query DITA content via GraphQL
  • Event System: Extensible event-driven architecture
  • AI Integration: Optional AI-powered content generation (submodule)

USAGE

Creating DITA Topics

  1. Navigate to /admin/content/dita-topics
  2. Click "Add DITA Topic"
  3. Select topic type (concept, task, reference, or generic topic)
  4. Fill in required fields:
    • Title
    • DITA ID (unique identifier)
    • Body content (DITA XML or rich text)
    • Metadata (audience, keywords, etc.)
  5. Save as draft or submit for review

Importing DITA Content

  1. Navigate to /admin/content/dita-ccms/import
  2. Upload DITA XML file or ZIP archive
  3. Map DITA elements to Drupal fields
  4. Run import (processed via queue for large files)

Exporting DITA Content

Via UI:

  1. Navigate to topic or map
  2. Click "Export" action
  3. Select format (DITA, HTML, PDF, etc.)
  4. Download generated file

Via API:

# Export single topic
GET /api/dita/topic/{id}/export?format=html

# Export entire map
GET /api/dita/map/{id}/export?format=pdf&include_topics=true

Publishing Workflow

  1. Author creates/edits topic (Draft state)
  2. Submit for review
  3. Reviewer approves/requests changes
  4. Approved content moves to Published state
  5. Published content available for export/API access

API DOCUMENTATION

REST Endpoints

Topics

  • GET /api/dita/topics - List all topics
  • GET /api/dita/topics/{id} - Get specific topic
  • POST /api/dita/topics - Create new topic
  • PATCH /api/dita/topics/{id} - Update topic
  • DELETE /api/dita/topics/{id} - Delete topic

Maps

  • GET /api/dita/maps - List all maps
  • GET /api/dita/maps/{id} - Get specific map
  • POST /api/dita/maps - Create new map
  • PATCH /api/dita/maps/{id} - Update map
  • DELETE /api/dita/maps/{id} - Delete map

Export

  • GET /api/dita/export/topic/{id} - Export single topic
  • GET /api/dita/export/map/{id} - Export map with topics

GraphQL Queries

# Get all topics
query {
  ditaTopics(limit: 10, offset: 0) {
    items {
      id
      title
      ditaId
      topicType
      status
    }
    total
  }
}

# Get specific topic
query {
  ditaTopic(id: "123") {
    id
    title
    body
    metadata {
      audience
      keywords
    }
  }
}

HOOKS

The module provides several hooks for extending functionality:

/**
 * Alter DITA topic before save.
 */
function hook_dita_topic_presave(\Drupal\dita_ccms\Entity\DitaTopic $topic) {
  // Custom logic
}

/**
 * Alter export data before processing.
 */
function hook_dita_export_alter(array &$data, string $format) {
  // Custom export modifications
}

/**
 * React to DITA import completion.
 */
function hook_dita_import_complete(array $imported_items) {
  // Post-import processing
}

THEMING

Template Files

  • dita-topic.html.twig - Single topic display
  • dita-topic-list.html.twig - Topic listing
  • dita-export-preview.html.twig - Export preview

Theme Suggestions

  • dita-topic--{topic-type}.html.twig
  • dita-topic--{view-mode}.html.twig
  • dita-topic--{topic-type}--{view-mode}.html.twig

TESTING

Running Tests

# Unit tests
phpunit web/modules/custom/dita_ccms/tests/src/Unit

# Kernel tests
phpunit web/modules/custom/dita_ccms/tests/src/Kernel

# Functional tests
phpunit web/modules/custom/dita_ccms/tests/src/Functional

# All tests
phpunit web/modules/custom/dita_ccms/tests

Test Coverage

  • Unit tests: Service classes, helpers, utilities
  • Kernel tests: Entity operations, API endpoints
  • Functional tests: User workflows, import/export

TROUBLESHOOTING

Common Issues

  1. Import fails with large files

    • Increase PHP memory limit
    • Enable queue processing via cron
    • Split large documentation sets
  2. Export timeout

    • Use queue-based export for large maps
    • Increase PHP execution time
    • Enable background processing
  3. Permission denied errors

    • Check file system permissions
    • Verify user roles and permissions
    • Check REST endpoint configuration

PERFORMANCE OPTIMIZATION

Caching

  • Enable render caching for topic displays
  • Use CDN for exported static files
  • Configure Redis/Memcached for queue processing

Database

  • Add indexes for frequently queried fields
  • Use database query optimization
  • Enable query caching

Queue Processing

  • Configure cron for regular queue processing
  • Use Drush for batch operations
  • Monitor queue performance

SECURITY CONSIDERATIONS

  • Validate all XML input to prevent XXE attacks
  • Sanitize HTML output from DITA transformations
  • Use proper access controls for sensitive documentation
  • Enable HTTPS for API endpoints
  • Implement rate limiting for API access
  • Regular security updates for dependencies

CONTRIBUTING

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

# Clone repository
git clone https://github.com/your-org/dita_ccms.git

# Install dependencies
composer install

# Run coding standards
vendor/bin/phpcs --standard=Drupal,DrupalPractice web/modules/custom/dita_ccms

# Fix coding standards
vendor/bin/phpcbf --standard=Drupal,DrupalPractice web/modules/custom/dita_ccms

MAINTAINERS

LICENSE

This project is licensed under the GNU General Public License v2.0 or later.

CREDITS

This module leverages the following excellent Drupal contrib modules:

  • Entity Construction Kit (ECK) - For flexible entity management
  • Feeds - For robust import capabilities
  • Workflows - For editorial workflow management
  • Views Data Export - For data export functionality

Special thanks to the Drupal community and all contributors.