Skip to content

Instantly share code, notes, and snippets.

@dmrrlc
Last active November 11, 2015 12:36
Show Gist options
  • Save dmrrlc/513cc522bbb0eaaad25b to your computer and use it in GitHub Desktop.
Save dmrrlc/513cc522bbb0eaaad25b to your computer and use it in GitHub Desktop.
Entity reference filter with drupal 8 - mymodule.views.inc
<?php
/**
* Implements hook_views_data_alter().
*/
function mymodule_views_data_alter(array &$data) {
$data['node_field_data']['related_content_titles'] = array(
'title' => t('Related content titles'),
'filter' => array(
'title' => t('Related content titles'),
'help' => t('Specify a list of titles a content node can have.'),
'field' => 'nid',
'id' => 'mymodule_related_content_titles'
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment