You are here

function yandex_metrics_reports_get_list in Yandex.Metrics 8.2

Same name and namespace in other branches
  1. 8.3 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_get_list()
  2. 6.2 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_get_list()
  3. 7.3 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_get_list()
  4. 7.2 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_get_list()

Returns list of all reports.

Return value

array

5 calls to yandex_metrics_reports_get_list()
YandexMetricsReportsController::ajax in yandex_metrics_reports/src/Controller/YandexMetricsReportsController.php
Menu callback; outputs content of one of the 4 reports. It is intended for AJAX calls.
YandexMetricsReportsSettingsForm::buildForm in yandex_metrics_reports/src/Form/YandexMetricsReportsSettingsForm.php
Form constructor.
YandexMetricsReportsSettingsForm::submitForm in yandex_metrics_reports/src/Form/YandexMetricsReportsSettingsForm.php
Form submission handler.
yandex_metrics_reports_ajax in yandex_metrics_reports/yandex_metrics_reports.module
Menu callback; outputs content of one of the 4 reports. It is intended for AJAX calls.
yandex_metrics_reports_get_active_list in yandex_metrics_reports/yandex_metrics_reports.module
Returns list of available and enabled reports only.

File

yandex_metrics_reports/yandex_metrics_reports.module, line 475
The main code of Yandex.Metrics Reports module.

Code

function yandex_metrics_reports_get_list($reset = FALSE) {
  $reports =& drupal_static(__FUNCTION__);
  if (!isset($reports) || $reset) {

    // Permanent cache.
    $cache = \Drupal::cache()
      ->get('yandex_metrics_reports_list');
    if ($cache === FALSE || $reset) {
      $reports = array();
      foreach (\Drupal::moduleHandler()
        ->getImplementations('yandex_metrics_reports_list') as $module) {
        $module_report_list = \Drupal::moduleHandler()
          ->invoke($module, 'yandex_metrics_reports_list');
        if (isset($module_report_list) && is_array($module_report_list)) {
          $reports = array_merge($reports, $module_report_list);
        }
      }

      // Allow other modules to alter reports list before caching.
      \Drupal::moduleHandler()
        ->alter('yandex_metrics_reports_list', $reports);
      \Drupal::cache()
        ->set('yandex_metrics_reports_list', $reports);
    }
    else {
      $reports = $cache->data;
    }
  }
  return $reports;
}