create-field-widget-action

Scaffold Drupal Field Widget Action plugins for AJAX or modal form actions.

10|4|Updated Jan 5, 2018
One-click install
npx skills add https://github.com/markconroy/markie --skill create-field-widget-action
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-field-widget-action
Source: https://github.com/markconroy/markie/tree/main/web/modules/contrib/ai/.agents/skills/create-field-widget-action
Command: npx skills add https://github.com/markconroy/markie --skill create-field-widget-action

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creates the boilerplate needed to add a new Drupal AI Field Widget Action plugin, so you can quickly deliver actionable AI-driven UI behavior inside entity forms.

Core Features & Use Cases

  • Action scaffolding with correct inheritance: Generates either an AJAX callback action (using FieldWidgetActionBase + getAjaxCallback()) or a modal form action (using FieldWidgetFormActionBase + buildModalForm() + submitModalFormFillFields()).
  • Plugin UI targeting and configuration: Establishes widget_types, field_types, category, multiple (per-delta vs whole-field), and a descriptive configuration baseline.
  • Field-filling behavior with proper commands: Uses FillSimpleFieldCommand for plain fields and FillEditorCommand for formatted (e.g., CKEditor) inputs when modal actions are used.

Quick Start

Ask the skill to scaffold an AJAX-based Field Widget Action plugin named my_module_suggest_text that targets string and text fields, uses an AI prompt configuration, and returns suggestions to fill the selected field.

Frequently Asked Questions about create-field-widget-action

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add an AJAX callback to a Drupal field widget form for AI interactions?

You generate a modal form action plugin by extending FieldWidgetFormActionBase and implementing buildModalForm() alongside submitModalFormFillFields() to trigger interactive AI prompts within entity forms.

How do I target specific field and widget types when building a Drupal AI form action?

For formatted text inputs like CKEditor, modal form actions use FillEditorCommand, whereas plain fields use FillSimpleFieldCommand to properly inject AI-generated content into the entity form.

Do I need dependency injection for a custom Drupal field widget action plugin?

The scaffolding process establishes a descriptive configuration baseline and wires up the UI, allowing you to capture AI prompts and manage settings directly within the Drupal entity form interface.

What is the difference between per-delta and whole-field actions in Drupal AI widget plugins?

Field widget action scaffolding generates the required base class methods and UI wiring automatically, eliminating the need to manually write boilerplate code for interactive AI behaviors in entity forms.