Entity Builder UI#
The eb_ui module provides the base UI functionality for Entity Builder, including a YAML editor interface and shared API endpoints used by all grid providers.
Overview#
eb_ui serves two primary purposes:
- YAML Editor Fallback: Provides a CodeMirror-based YAML editor when no grid provider is active
- Shared API Endpoints: Provides validation, preview, and entity configuration endpoints used by all UI components
Architecture#
Installation#
For AG-Grid spreadsheet interface, also enable:
Grid Provider System#
eb_ui discovers available grid providers via the hook_eb_ui_grid_provider_info hook:
Provider Selection#
The active provider is determined by eb_ui.settings.editor_mode:
| Value | Behavior |
|---|---|
yaml |
Always use YAML editor |
auto |
Use first available provider, fall back to YAML |
{provider_id} |
Use specific provider |
API Endpoints#
POST /eb/api/validate#
Validates YAML/JSON content against EB operations.
Headers Required:
- X-Requested-With: XMLHttpRequest
- X-CSRF-Token: {token}
- Content-Type: application/json or text/plain
Response:
POST /eb/api/preview#
Generates a preview of operations that will be performed.
Headers Required:
- X-Requested-With: XMLHttpRequest
- X-CSRF-Token: {token}
Response:
GET /eb/api/bundles/{entity_type}#
Fetches available bundles for an entity type.
Response:
GET /eb/api/entity-config/{entity_type}/{bundle}#
Fetches existing field configuration for an entity/bundle.
Response:
YAML Editor#
When no grid provider is active or when accessing the /source route, eb_ui displays a CodeMirror-based YAML editor:
Features#
- Syntax highlighting for YAML
- Line numbers
- Auto-indentation
- Error markers from validation
CodeMirror CDN#
The editor loads CodeMirror from CDN:
Configuration#
Navigate to Configuration > Development > Entity Builder > UI Settings:
| Setting | Default | Description |
|---|---|---|
editor_mode |
auto | Editor selection: yaml, auto, or provider ID |
yaml_editor |
codemirror_cdn | YAML editor type |
Security#
All API endpoints include:
- CSRF Protection: X-CSRF-Token header required for POST requests
- AJAX Validation: X-Requested-With header required
- Authentication: User must be authenticated
- Content Size Limits: Configurable maximum payload size
- Nesting Depth Limits: Configurable maximum JSON nesting
Creating Custom Grid Providers#
To create a custom grid provider:
-
Implement the hook:
-
Create the form class extending
FormBase: -
Add access checker (optional, for route priority):
Permissions#
| Permission | Description |
|---|---|
administer entity builder |
Access the UI |
Related Modules#
- eb_aggrid: AG-Grid spreadsheet provider for eb_ui
- eb: Core Entity Builder functionality