hyva-cms-custom-field▌
hyva-themes/hyva-ai-tools · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
This skill guides the creation of custom field types and field handlers for Hyvä CMS components. Custom field types extend the built-in field types (text, textarea, select, etc.) with specialized input controls for the CMS editor interface.
Hyvä CMS Custom Field Type Creator
Overview
This skill guides the creation of custom field types and field handlers for Hyvä CMS components. Custom field types extend the built-in field types (text, textarea, select, etc.) with specialized input controls for the CMS editor interface.
Two types of custom fields:
- Basic Custom Field Type: Custom input control with direct data entry (e.g., date range, color picker, custom validation)
- Field Handler: Enhanced UI with complex interactions (e.g., product selector with images, searchable dropdown, link configuration modal)
Command execution: For commands that need to run inside the development environment (e.g., bin/magento), use the hyva-exec-shell-cmd skill to detect the environment and determine the appropriate command wrapper.
Workflow
Step 1: Module Selection
If not already specified in the prompt, determine where to create the custom field type:
Option A: New Module
Use the hyva-create-module skill with:
dependencies:["Hyva_CmsBase", "Hyva_CmsLiveviewEditor"]composer_require:{"hyva-themes/commerce-module-cms": "^1.0"}
Option B: Existing Module
Verify the module has required dependencies:
Hyva_CmsBaseandHyva_CmsLiveviewEditorinetc/module.xmlhyva-themes/commerce-module-cmsincomposer.json
Add missing dependencies if needed.
Step 2: Field Type Details
Gather information about the custom field type:
- Field type name (lowercase identifier, e.g.,
date_range,product_selector,color_picker) - Purpose (what data does it collect?)
- UI pattern:
- Basic field: Simple input with validation (date picker, pattern input, enhanced text field)
- Inline handler: Enhanced control in field area (searchable dropdown, color picker)
- Modal handler: Separate dialog for complex selection (product selector, link builder, media gallery)
- Data structure (simple string, JSON object, array?)
- Validation requirements (pattern, required, custom rules?)
Step 3: Implementation Pattern Selection
Based on the UI pattern identified in Step 2:
Pattern A: Basic Custom Field Type
For simple inputs with custom HTML5 validation or specialized input controls:
- Single template file for the field
- No separate handler modal
- Example: Date range selector, custom pattern validation, slider input
Pattern B: Inline Field Handler
For enhanced controls that remain in the field area:
- Single template file with Alpine.js component
- No separate handler modal
- Example: Searchable select dropdown, color picker with swatches
Pattern C: Modal-Based Field Handler
For complex selection interfaces requiring more space:
- Field template (displays selection + trigger button)
- Handler modal template (separate dialog with full UI)
- Layout XML registration for the handler
- Example: Product selector, link configuration, media gallery
See references/handler-patterns.md for detailed implementation patterns and code examples for each type.
Step 4: Generate Field Template
Create the field template at view/adminhtml/templates/field-types/[field-type-name].phtml.
Required template elements:
- Field container with proper ID:
field-container-{uid}_{fieldName} - Input element(s) with name:
{uid}_{fieldName} - Validation messages container:
validation-messages-{uid}_{fieldName} updateWireField()orupdateField()call on value change- Error state handling via
$magewire->errors - IMPORTANT: Use null coalescing for field value:
$block->getData('value') ?? ''(NOT type casting)
Use the appropriate template from assets/templates/:
basic-field.phtml.tpl- Basic custom field typeinline-handler.phtml.tpl- Inline enhanced controlmodal-field.phtml.tpl- Modal handler field template
See references/template-requirements.md for detailed template requirements and patterns.
Step 5: Generate Handler Modal (if needed)
For modal-based handlers only, create the handler template at view/adminhtml/templates/handlers/[handler-name]-handler.phtml.
Handler modal structure:
<dialog>element with Alpine.js component andopen:flexclass (NOT staticflex)- Listen for initialization event from field template
- Implement selection UI (search, filters, grid, etc.)
- Dispatch
editor-changeevent on save
Use assets/templates/modal-handler.phtml.tpl as the starting point.
See references/handler-communication.md for event protocols and data exchange patterns.
Step 6: Register Field Type
Add registration to etc/adminhtml/di.xml:
<type name="Hyva\CmsLiveviewEditor\Model\CustomField">
<arguments>
<argument name="customTypes" xsi:type="array">
<item name="[field_type_name]" xsi:type="string">
[Vendor]_[Module]::field-types/[field-type-name].phtml
</item>
</argument>
</arguments>
</type>
Step 7: Register Handler Modal (if needed)
For modal-based handlers only, create or update view/adminhtml/layout/liveview_editor.xml:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="before.body.end">
<block name="[handler_name]_handler"
template="[Vendor]_[Module]::handlers/[handler-name]-handler.phtml"/>
</referenceContainer>
</body>
</page>
Note: Inline handlers do NOT require layout XML registration.
Step 8: Usage Example
Provide an example of using the custom field type in components.json:
{
"my_component": {
"label": "My Component",
"content": {
"[field_name]": {
"type": "custom_type",
"custom_type": "[field_type_name]",
"label": "Field Label",
"attributes": {
"required": true,
"pattern": ".*"
}
}
}
}
}
Resources
references/template-requirements.md
Complete reference for custom field type template requirements:
- Required markup patterns and element IDs
- Field container structure
- Validation message containers
- Field value update methods (
updateWireFieldvsupdateField) - HTML5 validation attributes
- Error state handling
Read this file when implementing the field template to ensure proper integration with the CMS editor.
references/handler-patterns.md
Implementation patterns for all three custom field types:
- Basic custom field type (simple input)
- Inline field handler (enhanced control)
- Modal-based field handler (dialog selection)
Each pattern includes:
- Complete code examples
- When to use each pattern
- Alpine.js component structure
- Data flow and state management
Read this file when selecting the implementation pattern and writing the template code.
references/handler-communication.md
Event protocols and data exchange for field handlers:
- Initialization event structure
- Save event structure
- Field value encoding/decoding
- Error handling patterns
- Common pitfalls and solutions
Read this file when implementing handler modals to understand the communication protocol.
references/built-in-handlers.md
Reference for Hyvä CMS built-in field handlers:
- Product Handler (modal-based, image grid selection)
- Link Handler (modal-based, multi-type link config)
- Searchable Select (inline enhanced dropdown)
Each includes:
- Location in Hyvä CMS module
- Key features and patterns
- Usage examples
- Code to examine for patterns
Read this file when looking for implementation examples or patterns to copy.
assets/templates/basic-field.phtml.tpl
Template for basic custom field types with custom validation or input controls.
Placeholders:
{{FIELD_TYPE_NAME}}- Custom field type identifier{{FIELD_INPUTS}}- Input element(s) HTML{{VALIDATION_LOGIC}}- Custom validation JavaScript (optional)
assets/templates/inline-handler.phtml.tpl
Template for inline enhanced controls (searchable dropdown, color picker, etc.).
Placeholders:
{{HANDLER_NAME}}- Alpine.js component name{{HANDLER_LOGIC}}- Alpine.js component implementation{{HANDLER_UI}}- Enhanced control HTML
assets/templates/modal-field.phtml.tpl
Field template for modal-based handlers (trigger button + hidden input).
Placeholders:
{{EVENT_NAME}}- Custom event name to dispatch{{BUTTON_LABEL}}- Button text{{DISPLAY_VALUE}}- Current selection display
assets/templates/modal-handler.phtml.tpl
Handler modal template for modal-based selection interfaces.
Placeholders:
{{HANDLER_NAME}}- Alpine.js component name{{MODAL_TITLE}}- Dialog header text{{SELECTION_UI}}- Selection interface HTML{{SAVE_LOGIC}}- Save button logic
Important Guidelines
Core Requirements
- Template Requirements: All custom field types must follow required markup patterns (container ID, input name, validation messages)
- Handler Registration: Modal handlers need layout XML registration; inline handlers do not
- Validation: Apply HTML5 validation attributes via
$filteredAttributesfor automatic validation - Alpine Components: If using custom Alpine components, keep input fields outside the component and update via vanilla JS
- Built-In Examples: Reference built-in handlers in
Hyva_CmsLiveviewEditor::page/js/for proven patterns
Accurate Patterns from Codebase
Based on built-in Hyvä CMS handler implementations:
-
Event Naming Convention: Use
toggle-{type}-selectpattern- ✅ Correct:
toggle-product-select,toggle-link-select,toggle-category-select - ❌ Incorrect:
toggle-product-handler,toggle-link-handler
- ✅ Correct:
-
Handler Function Naming: Use
init{Type}Select()pattern- ✅ Examples:
initProductSelect(),initLinkSelect(),initCategorySelect()
- ✅ Examples:
-
Field Value Update Methods:
- Use
updateWireField(default): Products, Link, Category handlers- Triggers immediate server-side validation via Magewire
- Keeps component state synchronized
- Use
updateField(specialized): Image handler, debounced inputs (color, range)- Updates preview without server round-trip
- Defers validation until save
- Use
-
JSON Encoding Pattern: All complex data (arrays, objects) must be JSON-encoded
// Field template value="<?= $escaper->escapeHtmlAttr(json_encode($fieldValue)) ?>" // Handler initialization const data = JSON.parse(fieldValue); // @change handler @change="updateWireField(..., JSON.parse($event.target.value))" -
wire:ignore for Livewire Compatibility: Searchable select uses
wire:ignorewrapper<div wire:ignore> <div x-data="initSearchableSelect(...)"> <!-- Alpine component --> </div> </div> -
Separate Handler Files: Even inline handlers may have separate function files
- Field template:
liveview/field-types/searchable_select.phtml - Handler function:
page/js/searchable-select-handler.phtml
- Field template:
-
Icons View Model: Use for UI elements
/** @var Icons $icons */ $icons = $viewModels->require(Icons::class); <?= /** @noEscape */ $icons->trashHtml('', 22, 22) ?> -
FieldTypes View Model: Use for attribute filtering
How to use hyva-cms-custom-field on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add hyva-cms-custom-field
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches hyva-cms-custom-field from GitHub repository hyva-themes/hyva-ai-tools and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate hyva-cms-custom-field. Access the skill through slash commands (e.g., /hyva-cms-custom-field) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★29 reviews- ★★★★★Alexander Bansal· Dec 28, 2024
hyva-cms-custom-field fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Kabir Mensah· Dec 24, 2024
Useful defaults in hyva-cms-custom-field — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Meera Malhotra· Dec 16, 2024
hyva-cms-custom-field has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Ganesh Mohane· Dec 12, 2024
We added hyva-cms-custom-field from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Arya Garcia· Nov 19, 2024
I recommend hyva-cms-custom-field for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Meera Johnson· Nov 7, 2024
Solid pick for teams standardizing on skills: hyva-cms-custom-field is focused, and the summary matches what you get after install.
- ★★★★★Rahul Santra· Nov 3, 2024
hyva-cms-custom-field reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Mei Khanna· Oct 26, 2024
I recommend hyva-cms-custom-field for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Pratham Ware· Oct 22, 2024
hyva-cms-custom-field is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Dev Sethi· Oct 10, 2024
Solid pick for teams standardizing on skills: hyva-cms-custom-field is focused, and the summary matches what you get after install.
showing 1-10 of 29