Contents

Backend\Behaviors\FormController\HasFormDesigns

Overview

HasFormDesigns manages the form design system, resolving and applying design behaviors to the controller based on the form configuration.


Protected Properties

protected bool $formDesignResolved

formDesignResolved tracks whether the form design has been resolved

protected string|null $formDesignClass

formDesignClass stores the resolved design class name


Public Methods

public formRenderDesignButtons()

public formRenderDesignButtons(): string 

formRenderDesignButtons renders the form buttons, delegated to the active design behavior with a default fallback.

public formRenderDesignError()

public formRenderDesignError($fatalError): string 

formRenderDesignError renders the form error state, delegated to the active design behavior with a default fallback.

public getDesignBodyClass()

public getDesignBodyClass(): void

getDesignBodyClass returns the body class from the active design behavior, falls back to null if no design is applied.

public getDesignDisplayMode()

public getDesignDisplayMode(): void

getDesignDisplayMode returns the display mode taken from the form configuration, defaults to basic display mode.

public getFormDesignObject()

public getFormDesignObject(): Backend\Classes\FormDesignBase|null 

getFormDesignObject returns the active form design behavior instance, or null if no design is applied.

public renderDesignContent()

public renderDesignContent($options = []): string 

renderDesignContent renders the form design content, delegated to the active design behavior. Returns empty by default for custom mode.

Protected Methods

protected applyFormDesign()

protected applyFormDesign($displayMode): void 

applyFormDesign resolves and applies a form design behavior to the controller

protected getDesignConfigValue()

protected getDesignConfigValue($name, $default = null): void

getDesignConfigValue reads a design config value from the YAML config, checking the context-specific value first, then falling back to the global value.

protected getDesignFormSize()

protected getDesignFormSize($name = 'size'): void

getDesignFormSize returns the page size taken from the form configuration, can also specify a custom configuration name, e.g. sidebarSize.

protected isGlobalDesignMode()

protected isGlobalDesignMode(): bool 

isGlobalDesignMode returns true if the design must be resolved early in beforeDisplay, before the form context is known. This is needed for designs that provide AJAX handlers on the index action.

protected resolveFormDesign()

protected resolveFormDesign(): void 

resolveFormDesign applies the appropriate form design behavior to the controller based on the current context. Called from create/update/preview actions after context is set.

protected resolveFormDesignClass()

protected resolveFormDesignClass($code): string|null 

resolveFormDesignClass returns the class name for a given design code by checking all registered form designs from plugins and modules.