You are here

yandex_metrics_reports.api.php in Yandex.Metrics 6.2

Hooks provided by the Yandex.Metrics Reports module.

File

yandex_metrics_reports/yandex_metrics_reports.api.php
View source
<?php

/**
 * @file
 * Hooks provided by the Yandex.Metrics Reports module.
 */

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Provide metadata about available reports.
 *
 * @return
 *   An associative array of available reports.
 */
function hook_yandex_metrics_reports_list() {
  $reports = array();

  // I strongly recommend only use letters, numbers and underscores for keys of this array!
  $reports['my_custom_report'] = array(
    // String for Reports settings page.
    'title' => t('My Custom Report'),
    // Name of the function that generates your report.
    'callback' => 'mymodule_my_custom_report',
  );
  return $reports;
}

/**
 * @} End of "addtogroup hooks".
 */

/*
 * The example of user-defined callback for My Custom Report.
 *
 * Should handle $counter_id and $filter parameters.
 * This function MUST return string, not array or object.
 *
 * @see hook_yandex_metrics_reports_list()
 *
 * @param $counter_id
 * @param $filter
 * @return string
 */
function mymodule_my_custom_report($counter_id, $filter) {
  return '<p>' . t('My custom report by') . $counter_id . ' for ' . $filter . '</p>';
}

Functions

Namesort descending Description
hook_yandex_metrics_reports_list Provide metadata about available reports.
mymodule_my_custom_report