Piwik\Plugin\Report::getProcessedMetrics PHP Method

getProcessedMetrics() public method

Returns an array of supported processed metrics and their corresponding translations. Eg array('nb_visits' => 'Visits'). By default the given {@link $processedMetrics} are used and their corresponding translations are looked up automatically. If a metric is not translated, you should add the default metric translation for this metric using the {@hook Metrics.getDefaultMetricTranslations} event. If you want to overwrite any default metric translation you should overwrite this method, call this parent method to get all default translations and overwrite any custom metric translations.
public getProcessedMetrics ( ) : array | mixed
return array | mixed
    public function getProcessedMetrics()
    {
        if (!is_array($this->processedMetrics)) {
            return $this->processedMetrics;
        }
        return $this->getMetricTranslations($this->processedMetrics);
    }

Usage Example

コード例 #1
0
ファイル: Get.php プロジェクト: JoeHorn/piwik
 public function getProcessedMetrics()
 {
     $metrics = parent::getProcessedMetrics();
     $metrics['avg_time_on_site'] = Piwik::translate('General_VisitDuration');
     return $metrics;
 }