sc_widget_config($arrayOptions)
|
|
The sc_widget_config() macro allows you to dynamically change the visual properties of the widget being executed. It must be used inside the onWidgetLoad event and applies settings only to the current widget.
This macro receives a single associative array containing the configuration options for the widget.
Example array structure:
sc_widget_config([
'title' => 'My title',
'border-color' => '#FF0000'
]);
Parameters by widget type
Available options vary depending on the type of widget being modified. See below for each type.
Link Widget
| Parameter |
Value |
Description |
title |
'title' => 'Widget title' |
Defines the title displayed at the top of the widget. |
border-color |
'border-color' => '#FF0000' |
Border color of the widget, in hexadecimal format. |
Divider Widget
| Parameter |
Value |
Description |
title |
'title' => 'Main Section' |
Title of the section created by the divider widget. |
subtitle |
'subtitle' => 'Complementary description' |
Text displayed below the divider title. |
background-color |
'background-color' => '#F1F1F1' |
Background color of the widget, in hexadecimal format. |
border-color |
'border-color' => '#CCCCCC' |
Border color of the widget, in hexadecimal format. |
Index Widget
| Parameter |
Value |
Description |
title |
'title' => 'Sales Indicator' |
Title displayed at the top of the index widget. |
legend |
'legend' => 'Compared to last month' |
Text shown below the index's main value. |
background-color |
'background-color' => '#E0FFE0' |
Background color of the widget, in hexadecimal format. |
border-color |
'border-color' => '#00CC00' |
Border color of the widget, in hexadecimal format. |
Full example
$widgetName = sc_widget_name();
if ($widgetName == 'sales_index') {
sc_widget_config([
'title' => 'Monthly Sales',
'legend' => 'Compared to last month',
'background-color' => '#f0f0f0',
'border-color' => '#999999',
]);
}
In the example above, the sc_widget_config() macro is used to apply visual settings to the widget identified as sales_index.
|
Macro Scope
|
Dashboard
|
allMacros onWidgetLoad
|
|