Contents

Dashboard\Behaviors\DashController

Overview

DashController adds features for working with dashboard reports. This behavior will include methods for rendering registered dashboards to the controller along with some relevant AJAX handlers.

This behavior is implemented in the controller like so:

public $implement = [
    \Dashboard\Behaviors\DashController::class,
];

public $dashConfig = 'config_dash.yaml';

The $dashConfig property makes reference to the form configuration values as either a YAML file, located in the controller view directory, or directly as a PHP array.

Extends
See Also

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected string $definition

definition code for the active dashboard

protected array $dashDefinitions

dashDefinitions are keys for alias and value for configuration.

protected array $dashConfig

dashConfig are keys for alias and value for config objects.

protected Backend\Classes\WidgetBase $dashWidget

dashWidget reference to the dash widget object.

protected array $requiredProperties

requiredProperties in the controller

protected array $requiredDashProperties

requiredDashProperties that must exist for each dashboard definition

protected array $requiredConfig

requiredConfig values that must exist when applying the primary config file.

protected object $originalConfig

originalConfig values

Show inherited protected properties

Inherited Protected Properties


Public Methods

public __construct()

public __construct(Backend\Classes\Controller $controller): void

__construct the behavior

public dashGetConfig()

public dashGetConfig(): object|null 

dashGetConfig returns the configuration used by this behavior. You may override this method in your controller as an alternative to defining a dashConfig property.

public dashGetId()

public dashGetId(string $suffix = null): string 

dashGetId returns a unique ID for this dash and field combination.

public dashHasDefinition()

public dashHasDefinition($definition): bool 

public dashMakePartial()

public dashMakePartial(string $partial, array $params = []): string 

dashMakePartial is a controller accessor for making partials within this behavior.

public dashRegisterDefinition()

public dashRegisterDefinition($dashName, $config): void

dashRegisterDefinition registers a new dash dynamically

public dashRender()

public dashRender(array $options, $options = []): string 

dashRender the prepared form markup. This method is usually called from a view file.

<?= $this->dashRender('system') ?>

The first argument supports an array of render options. The supported options can be found via the render method of the Dash widget class.

<?= $this->dashRender('system', ['preview' => true]) ?>
See Also

public initDash()

public initDash($definition = null): void

public prepareVars()

public prepareVars(): void

prepareVars for display

Show inherited public methods

Inherited Public Methods

Protected Methods

protected makeDashWidget()

protected makeDashWidget(): Backend\Classes\WidgetBase 

makeDash prepares the widgets used by this action

protected validateDash()

protected validateDash(string $definition): string 

validateDash validates the supplied field and initializes the dashboard.

Show inherited protected methods

Inherited Protected Methods