function farm_metrics_dashboard_pane in farmOS 7
Metrics dashboard callback.
1 string reference to 'farm_metrics_dashboard_pane'
- farm_metrics_farm_dashboard_panes in modules/
farm/ farm_metrics/ farm_metrics.farm_dashboard.inc - Implements hook_farm_dashboard_panes().
File
- modules/
farm/ farm_metrics/ farm_metrics.farm_dashboard.inc, line 25 - Farm dashboard hooks implemented by farm_metrics module.
Code
function farm_metrics_dashboard_pane() {
// Load metrics.
$metrics = farm_metrics();
// If no metrics are available, show a message.
if (empty($metrics)) {
return 'No metrics available.';
}
// Iterate through the metrics and build rendered metrics.
$rendered_metrics = array();
foreach ($metrics as $metric) {
$rendered_metrics[] = '<li role="presentation"><a href="' . url($metric['link']) . '">' . $metric['label'] . ' <span class="badge">' . $metric['value'] . '</span></a></li>';
}
// Build and return the final output.
$output = '<ul class="nav nav-pills" role="tablist">';
$output .= implode('', $rendered_metrics);
$output .= '</ul>';
return $output;
}