Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Soundcite 2.0.8 Minor update available for module soundcite (2.0.8). Release: Drupal Website Security 12.0.2 Minor update available for module websecurity (12.0.2). Release: DonorPerfect 1.0.20 Minor update available for module donorperfect (1.0.20). Release: Bootstrap Cloud 7.1.5 Minor update available for theme bootstrap_cloud (7.1.5). Release: Varbase Project 11.0.9 Minor update available for module varbase_project (11.0.9). Release: Webships Starter 2.0.1 Minor update available for module webships_starter (2.0.1). Release: WebAPI Starter 2.0.1 Minor update available for module webapi_starter (2.0.1). Release: Webships Project Template 1.0.0 Initial release available for module webships_project (1.0.0)! Module Revived: Flag for Someone Else 1.0.2 Module flag_fse updated after 9 months of inactivity (1.0.2). Security Coverage: smart 404 Module smart_404 now has official Drupal security advisory coverage.

AI Content Hub

No security coverage

Part of the AI ecosystem · 308 projects

View on drupal.org

This module extracts content and structure from existing Drupal pages to create JSON data that external AI can use to generate new content. It then takes the AI-generated JSON and uses it to create or update Drupal entities, offering previews before saving.

1. Extract a node as JSON

Read an existing node's fields into JSON using the entity processor manager.

$processor = \Drupal::service('ai_content_hub.entity_processor_manager')
  ->getProcessor('node', $source_node->bundle());

$extracted_json = $processor->extract($source_node);

2. Ask an LLM to generate a new page

Share one or more extracted JSONs of the same content type with any LLM and ask it to generate a new page following the same structure, giving you back an $ai_json payload.

3. Preview the generated page

Feed the $ai_json and the ID of an existing node of the same content type to render the page as HTML you can display anywhere, such as an iframe, without saving anything or leaving orphaned nodes or paragraphs behind.

$existing_node = \Drupal\node\Entity\Node::load($existing_node_id);

$preview_html = \Drupal::service(\Drupal\ai_content_hub\Render\PreviewDocumentGenerator::class)
  ->generate($ai_json, $existing_node);

4. Refine until you're satisfied

Ask the LLM to update $ai_json and preview it again as many times as you like.

5. Convert the preview to a new node

Once satisfied, hydrate the same $ai_json in create mode to save it as a new node.

$processor = \Drupal::service('ai_content_hub.entity_processor_manager')
  ->getProcessor('node', $bundle);

$new_node = $processor->hydrate($ai_json, 'create', entityType: 'node', bundle: $bundle);

6. Update the new node later

To make further changes, ask the LLM to update the JSON again and hydrate it in override mode using the new node's own ID as the reference, not the original one you started from.

$new_node = \Drupal\node\Entity\Node::load($new_node_id);

$processor = \Drupal::service('ai_content_hub.entity_processor_manager')
  ->getProcessor('node', $new_node->bundle());

$updated_node = $processor->hydrate($updated_ai_json, 'override', $new_node);

7. Handle a missing or wrongly-shaped field

Is a field missing from the extracted JSON, or do you want to change how an existing field's value is shaped? Add a FieldProcessor plugin for that field type.

declare(strict_types=1);

namespace Drupal\my_module\Plugin\FieldProcessor;

use Drupal\ai_content_hub\Attribute\FieldProcessor;
use Drupal\ai_content_hub\Plugin\SimpleFieldProcessorBase;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;

#[FieldProcessor(
  id: 'my_field_type',
  label: new TranslatableMarkup('My field type'),
  field_types: ['my_field_type'],
  priority: 0,
)]
class MyFieldTypeProcessor extends SimpleFieldProcessorBase {

  protected function extractItem(FieldItemInterface $item, FieldDefinitionInterface $definition): array {
    return ['value' => $item->value];
  }

  protected function hydrateItem(FieldItemInterface $item, array $data): void {
    $item->setValue(['value' => $data['value'] ?? NULL]);
  }

}

8. Build your own workflow on top

The steps above are just one workflow; point your own coding agent at this module and describe what you want built. For example, ask it to build a chatbot panel inside the Drupal UI, using Drupal's AI and AI Agents ecosystem, that lets a site editor chat on the left while the generated page previews live on the right, only creating the actual node once they click a Save page button. Coming soon.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Aug 2026
Latest release
1 month ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.0.0-alpha2 Pre-release 11 Aug 12, 2026
1.0.0-alpha1 Pre-release 10–11 Aug 11, 2026
1.x-dev Dev 11 Aug 6, 2026