Webform Content Creator
Automatically creates and synchronizes content entities based on webform submissions with configurable field mappings.
webform_content_creator
Install
composer require 'drupal/webform_content_creator:^4.0'
Overview
Webform Content Creator is a powerful Drupal module that automates the creation of content entities when webforms are submitted. It provides a flexible configuration interface that allows administrators to define mappings between webform submission values and content entity fields.
The module supports any content entity type in Drupal (nodes, custom entities, etc.) and provides bi-directional synchronization capabilities. When a webform submission is edited or deleted, the corresponding content entity can be automatically updated or removed. The module also integrates with the Webform Encrypt module to handle encrypted field values transparently.
Field mappings can use either direct webform field values or custom text with token substitution, giving administrators complete flexibility in how content is generated from form submissions.
Features
- Automatic content entity creation triggered by webform submissions
- Support for any Drupal content entity type (nodes, custom entities, etc.)
- Configurable field mappings between webform elements and entity fields
- Custom text values with token substitution support (webform_submission tokens)
- Bi-directional synchronization: content updates when webform submissions are edited
- Automatic content deletion when associated webform submissions are deleted
- Integration with Webform Encrypt module for encrypted field value decryption
- Automatic field value truncation when max length is exceeded (with logging)
- Date/datetime field type conversion and formatting
- Entity reference field validation
- Wizard page organization of webform elements in the mapping interface
- AJAX-powered entity type and bundle selection
- Automatic cleanup: configurations deleted when referenced webforms or entity types are removed
Use Cases
Lead Generation System
Create a contact form webform and automatically generate Lead content entities when visitors submit the form. Map name, email, phone, and message fields to corresponding content fields. Use the synchronization feature to allow sales staff to update leads via webform submission edits.
Event Registration
Build an event registration webform and automatically create Attendee content entities. Map registrant details, session preferences, and dietary requirements. Enable delete synchronization so cancelled registrations automatically remove the attendee record.
Support Ticket System
Create a support request webform that generates Ticket content entities. Use custom text with tokens to generate structured ticket titles like '[webform_submission:values:category] - [webform_submission:values:subject]'. Enable edit sync so users can update their tickets through the webform.
Application Processing
Build a job application webform that creates Application content entities. Map applicant information, resume uploads, and position preferences. Use the encryption integration to safely handle sensitive personal data.
Content Submission Workflow
Allow authenticated users to submit articles through a webform, automatically creating Article content entities in draft status. Map the body field using tokens and set the author using the submission user token.
Survey Response Collection
Create survey webforms that generate Response content entities for each submission. Map survey answers to custom fields for reporting and analysis. Use serial number tokens to create unique response identifiers.
Tips
- Always map required content fields to avoid creation failures
- Use the Token browser to discover available webform_submission tokens for custom text
- Create a dedicated field on your content type to store the submission ID when using synchronization
- Test with draft submissions first - content is only created when the submission is finalized
- Consider using the serial number token for unique content titles: [webform_submission:serial]
- For complex field mappings, use custom text with multiple tokens combined
- When changing webform, entity type, or bundle in a configuration, all field mappings are reset - export your configuration first
- The module logs errors to Drupal's database log (dblog) - check Recent log messages when troubleshooting
Technical Details
Admin Pages 5
/admin/config/webform_content_creator
Main configuration page listing all Webform Content Creator configurations. Displays a table with each configuration's title (with machine name), associated webform, target entity type, and bundle. Provides operations to edit, delete, or manage field mappings for each configuration.
/admin/config/webform_content_creator/add
Form to create a new Webform Content Creator configuration. Defines the relationship between a webform and a target content entity type.
/admin/config/webform_content_creator/{webform_content_creator}
Edit an existing Webform Content Creator configuration. Note: Changing the webform, entity type, or bundle will reset all field mappings.
/admin/config/webform_content_creator/manage/{webform_content_creator}/fields
Configure field mappings between webform submission values and content entity fields. Each row represents a content entity field that can be mapped to either a webform element or custom text with tokens.
/admin/config/webform_content_creator/{webform_content_creator}/delete
Confirmation form for deleting a Webform Content Creator configuration.
Permissions 1
Hooks 5
hook_webform_submission_insert
Triggered when a non-draft webform submission is created. Loads all Webform Content Creator configurations and creates content entities for matching webforms.
hook_webform_submission_update
Triggered when a webform submission is updated. If the original was a draft and the update is not, creates new content. If both are non-draft and sync is enabled, updates existing content.
hook_webform_submission_delete
Triggered when a webform submission is deleted. If delete synchronization is enabled, deletes the corresponding content entity.
hook_entity_type_delete
Triggered when an entity type (content type) is deleted. Removes Webform Content Creator configurations that reference the deleted entity type.
hook_webform_delete
Triggered when a webform is deleted. Removes all Webform Content Creator configurations that reference the deleted webform.
Troubleshooting 7
Verify that: 1) The webform submission is not a draft, 2) The Webform Content Creator configuration exists and matches the webform ID, 3) Required content fields are mapped, 4) The target entity type and bundle still exist. Check Recent log messages for errors.
The webform field type must be compatible with the content field type. Email fields can only map to email content fields. For text fields, ensure you're mapping to text/string field types. Consider using custom text with tokens as a workaround.
Ensure: 1) 'Synchronize in edition' checkbox is enabled in configuration, 2) The sync_content_field is specified, 3) A field with that machine name exists on the content type, 4) The sync field is mapped to the Submission ID property in Manage Fields.
Check if 'Synchronize in deletion' is enabled. This will delete content when the associated webform submission is deleted. Disable this option if you want to preserve content independently.
Enable 'Decrypt values' in the configuration and select the correct encryption profile. Ensure the Webform Encrypt module is installed and properly configured with the same encryption profile used by the webform.
This is expected behavior when the content field has a max_length setting and the value exceeds it. Check Recent log messages for notices about truncation. Consider increasing the content field's max length or using a long text field type.
Webform Content Creator automatically deletes configurations when the referenced webform or entity type/bundle is deleted. This is by design to prevent orphaned configurations.
Security Notes 6
- The module requires the 'access webform content creator configuration' permission for admin access
- Content is created with no author by default - map the uid field if author attribution is needed
- Encrypted field decryption requires proper encryption profile configuration
- Ensure content type permissions are properly configured for automatically created content
- The sync_content_field should not be editable by end users to prevent manipulation of content relationships
- Token values are not automatically sanitized - be cautious when mapping to fields that render HTML