You are here

function filehash_views_data in File Hash 8

Same name and namespace in other branches
  1. 7 filehash.views.inc \filehash_views_data()

Implements hook_views_data().

File

./filehash.views.inc, line 11
Provide views data and handlers for filehash table.

Code

function filehash_views_data() {
  $data['filehash']['table']['group'] = t('File');
  $data['filehash']['table']['join'] = [
    'file_managed' => [
      'left_field' => 'fid',
      'field' => 'fid',
    ],
  ];

  // Use a nice human-readable name for each hash algorithm.
  $names = filehash_names();
  foreach (filehash_algos() as $algo) {
    $data['filehash'][$algo] = [
      'title' => t('@algo hash', [
        '@algo' => $names[$algo],
      ]),
      'help' => t('The @algo hash of the file.', [
        '@algo' => $names[$algo],
      ]),
      'field' => [
        'id' => 'standard',
        'click sortable' => TRUE,
      ],
      'argument' => [
        'id' => 'string',
      ],
      'filter' => [
        'id' => 'string',
      ],
      'sort' => [
        'id' => 'standard',
      ],
    ];
  }
  return $data;
}