You are here

function download_count_views_data_alter in Download Count 7.2

Same name and namespace in other branches
  1. 8 download_count.views.inc \download_count_views_data_alter()
  2. 6.2 includes/download_count.views.inc \download_count_views_data_alter()
  3. 7.3 includes/download_count.views.inc \download_count_views_data_alter()

Implements hook_views_data_alter().

Replaces default views file field link formatters with download_count formatter.

File

includes/download_count.views.inc, line 177
Provide views data for the download_count.module.

Code

function download_count_views_data_alter(&$data) {
  foreach ($data as $module => $m) {
    foreach ($m as $column => $c) {
      foreach ($c as $property => $p) {
        if ($property == 'field' && !empty($p['handler'])) {
          switch ($p['handler']) {
            case 'views_handler_field_file':
              $data[$module][$column][$property]['handler'] = 'download_count_views_handler_field_file';
              break;
          }
        }
      }
    }
  }
}