Skip to content

feat(forms): add an interface for embeddable question types - #25065

Open
UncleTomsCabi wants to merge 1 commit into
glpi-project:11.0/bugfixesfrom
UncleTomsCabi:11.0/bugfixes
Open

feat(forms): add an interface for embeddable question types#25065
UncleTomsCabi wants to merge 1 commit into
glpi-project:11.0/bugfixesfrom
UncleTomsCabi:11.0/bugfixes

Conversation

@UncleTomsCabi

@UncleTomsCabi UncleTomsCabi commented Aug 1, 2026

Copy link
Copy Markdown

Summary

Introduce a dedicated interface for question types that can be rendered inside another question type.

This adds a standard contract that allows composite question types (such as table questions) to reuse administration and end-user rendering provided by other question types without relying on plugin-specific implementations.

The interface currently defines two responsibilities:

  • rendering administration controls with a supplied input prefix;
  • rendering end-user controls with a supplied input name.

No existing question type is modified by this change.

Motivation

Currently there is no standard way for a question type to expose embeddable rendering.

As a result, plugins must rely on runtime capability detection (method_exists()) or hard dependencies between plugins.

Adding this interface provides a generic extension point that can be reused by any current or future question type.

Backward compatibility

This change is fully backward compatible.

Existing question types continue working without modification.

Only question types implementing the new interface expose the additional capability.

Related

## Summary

Introduce a dedicated interface for question types that can be rendered inside another question type.

This adds a standard contract that allows composite question types (such as table questions) to reuse administration and end-user rendering provided by other question types without relying on plugin-specific implementations.

The interface currently defines two responsibilities:

- rendering administration controls with a supplied input prefix;
- rendering end-user controls with a supplied input name.

No existing question type is modified by this change.

## Motivation

Currently there is no standard way for a question type to expose embeddable rendering.

As a result, plugins must rely on runtime capability detection (`method_exists()`) or hard dependencies between plugins.

Adding this interface provides a generic extension point that can be reused by any current or future question type.

## Backward compatibility

This change is fully backward compatible.

Existing question types continue working without modification.

Only question types implementing the new interface expose the additional capability.

## Related

- Fields PR:
- Advanced Forms PR:
UncleTomsCabi added a commit to UncleTomsCabi/advancedforms that referenced this pull request Aug 2, 2026
## Summary

Add support for embeddable question types inside table question columns.

Instead of knowing about specific plugins, the table question now delegates rendering to any question type implementing the new embeddable interface.

## What is implemented

- support for embeddable question types;
- dynamic column configuration loading;
- embedded administration rendering;
- embedded end-user rendering;
- server-side rendering for dynamically added table rows;
- validation and preparation of embedded question extra data.

## Why server-side row rendering?

Originally, additional table rows were created entirely in JavaScript.

This approach worked for built-in question types because their client-side configuration was sufficient to recreate the controls.

With embeddable question types, this is no longer enough. Embedded question types are responsible for rendering and initializing their own controls, which may include server-generated markup, unique identifiers and initialization logic.

To keep this responsibility inside each question type and avoid duplicating rendering logic in JavaScript, newly added rows are now rendered on demand by the server through a dedicated controller. The controller simply exposes the existing row rendering logic already used for the initial table rendering, ensuring that dynamically added rows behave exactly like the initially rendered ones.

## Motivation

The table question previously only supported built-in question types.

With this change, any question type implementing the embeddable interface can be used inside a table without introducing plugin-specific rendering logic into Advanced Forms.

## Backward compatibility

Existing built-in question types continue to work exactly as before.

Plugins that do not implement the embeddable interface are unaffected.

## Related

Depends on:

- GLPI Core PR: glpi-project/glpi#25065

Example implementation:

- Fields PR: pluginsGLPI/fields#1235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant