You are here

function similarterms_views_data_alter in Similar By Terms 8

Same name and namespace in other branches
  1. 7.2 views/similarterms.views.inc \similarterms_views_data_alter()

Implements hook_views_data_alter().

File

./similarterms.views.inc, line 11
Provide a custom views field data that isn't tied to any other module.

Code

function similarterms_views_data_alter(&$data) {
  $data['node']['similarterms'] = [
    'group' => t('Similar by terms'),
    'title' => t('Similarity'),
    'help' => t('Percentage/count of terms which node has in common with node given as argument.'),
    'field' => [
      'id' => 'similar_terms_field',
    ],
    'sort' => [
      'id' => 'similar_terms_sort',
    ],
  ];
  $data['node']['similar_nid'] = [
    'title' => t('Nid'),
    'group' => t('Similar by terms'),
    'help' => t('ID of content item(s).'),
    'argument' => [
      'id' => 'similar_terms_arg',
      'name field' => 'title',
      'numeric' => TRUE,
      'validate type' => 'nid',
    ],
  ];
}