Skip to main content

Droost: Display Compose

droost_display_compose Write (gated)

Module: Droost Display

The structured-content composer: binds each field of a view display to an SDC with prop/slot sources, validated against the component schema and the UI Patterns source registry, all-or-nothing. For teasers use the single-anchor pattern (one field carries the card; tokens pull siblings). dry_run rehearses; the write is gated.

Example call
{
    "tool": "droost_display_compose",
    "arguments": {
        "bundle": "tool",
        "view_mode": "teaser",
        "dry_run": true,
        "items": [
            {
                "field": "field_tool_label",
                "component": "droost_tailwind:card",
                "props": {
                    "title": {
                        "source_id": "token",
                        "source": {
                            "value": "[node:title]"
                        }
                    },
                    "badge": {
                        "source_id": "token",
                        "source": {
                            "value": "[node:field_tool_tier]"
                        }
                    },
                    "url": {
                        "source_id": "entity_link"
                    }
                },
                "slots": {
                    "content": [
                        {
                            "source_id": "token",
                            "source": {
                                "value": "[node:field_tool_label]"
                            }
                        }
                    ]
                }
            }
        ]
    }
}
Example response — captured live on this site
{
    "success": true,
    "message": "Dry run: 1 field(s) would be bound to SDCs on node.tool.teaser. Valid — call again with dry_run=false to persist.",
    "data": {
        "content": {
            "field_tool_label": {
                "type": "ui_patterns_component_per_item",
                "label": "hidden",
                "weight": 0,
                "settings": {
                    "ui_patterns": {
                        "component_id": "droost_tailwind:card",
                        "variant_id": null,
                        "props": {
                            "title": {
                                "source_id": "token",
                                "source": {
                                    "value": "[node:title]"
                                }
                            },
                            "badge": {
                                "source_id": "token",
                                "source": {
                                    "value": "[node:field_tool_tier]"
                                }
                            },
                            "url": {
                                "source_id": "entity_link"
                            }
                        },
                        "slots": {
                            "content": {
                                "sources": [
                                    
… (truncated — run it yourself for the rest)

Composes an entity view display (Manage Display) from SDCs: each item binds one field to one component with prop/slot source mappings; everything else is hidden by default. Validates fields, components, prop/slot names, required props, and source applicability before writing, then persists through the entity API (dependencies auto-calculated). Use droost_sdc_components, droost_display_sources, and droost_display_get to discover valid inputs. Set dry_run=true to validate without saving. Destructive (config write): requires droost.settings.allow_destructive.

Input schema (JSON Schema)
{
    "type": "object",
    "properties": {
        "entity_type": {
            "type": "string",
            "description": "Entity type id (default \"node\")."
        },
        "bundle": {
            "type": "string",
            "description": "Bundle machine name, e.g. \"event\"."
        },
        "view_mode": {
            "type": "string",
            "description": "View mode machine name (default \"default\")."
        },
        "items": {
            "type": "array",
            "description": "The composition: one entry per field to place, in display order.",
            "items": {
                "type": "object",
                "properties": {
                    "field": {
                        "type": "string",
                        "description": "Field machine name, e.g. \"field_event_date\"."
                    },
                    "component": {
                        "type": "string",
                        "description": "SDC id, e.g. \"droost_examples:example_card\"."
                    },
                    "variant": {
                        "type": "string",
                        "description": "Component variant id (only for components declaring variants)."
                    },
                    "props": {
                        "type": "object",
                        "description": "Prop bindings: prop name → {source_id, source?}. source_id may be a dynamic derivative (e.g. \"field_property:node:field_event_date:value\"); source carries that source's settings when it needs any (e.g. {\"value\": \"text\"} for textfield)."
                    },
                    "slots": {
                        "type": "object",
                        "description": "Slot bindings: slot name → ordered list of {source_id, source?} (e.g. [{\"source_id\": \"field_formatter:node:event:body\", \"source\": {\"type\": \"text_default\", \"settings\": {}}}])."
                    },
                    "label": {
                        "type": "string",
                        "enum": [
                            "hidden",
                            "above",
                            "inline",
                            "visually_hidden"
                        ],
                        "description": "Field label position (default \"hidden\" — SDC output usually carries its own headings)."
                    },
                    "weight": {
                        "type": "integer",
                        "description": "Display weight (defaults to the item's position)."
                    },
                    "per_item": {
                        "type": "boolean",
                        "description": "Render one component per field item (default; required for single-value fields) vs one component for the whole list (multi-value fields only)."
                    }
                },
                "required": [
                    "field",
                    "component"
                ]
            }
        },
        "hide_others": {
            "type": "boolean",
            "description": "Hide every field not listed in items (default true) so the rendered output is SDC-only."
        },
        "dry_run": {
            "type": "boolean",
            "description": "Validate and return the would-be configuration without saving (default false)."
        }
    },
    "required": [
        "bundle",
        "items"
    ]
}