¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.
dashboard_statistics
The dashboard_statistics
hook allows developers to add custom statistics to the dashboard.
Plugins can contribute their own metrics, which will be merged into the global statistics array.
$pluginStats = DynamicHooks::executeHook('dashboard_statistics');
// Merge plugin statistics into the counts
if (!empty($pluginStats) && is_array($pluginStats)) {
foreach ($pluginStats as $namespace => $stats) {
if (is_array($stats)) {
foreach ($stats as $statKey => $stat) {
if (isset($stat['label']) && isset($stat['value'])) {
$JSCMS_COUNTS[$statKey] = $stat;
}
}
}
}
}
This hook provides a mechanism to dynamically extend dashboard statistics with plugin-defined metrics.
DynamicHooks::addHook('dashboard_statistics', function () {
return [
'custom_stat' => [
'label' => 'Custom Metric',
'value' => 12345,
'icon' => 'fas fa-chart-line', // Optional
]
];
}, 'custom_plugin_namespace');
label
or value
).$JSCMS_COUNTS
) for conflicts or missing data.