From a6b383ab2e0ee1380203c9f3f5ca0a38d76f0abb Mon Sep 17 00:00:00 2001 From: thierrydallacroce Date: Wed, 19 Feb 2020 09:54:34 -0800 Subject: [PATCH] Not all views display entities (#322) --- modules/custom/dkan_admin/dkan_admin.module | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/custom/dkan_admin/dkan_admin.module b/modules/custom/dkan_admin/dkan_admin.module index 54b973dc8..a6d3bb0e9 100644 --- a/modules/custom/dkan_admin/dkan_admin.module +++ b/modules/custom/dkan_admin/dkan_admin.module @@ -35,17 +35,18 @@ function dkan_admin_form_views_exposed_form_alter(&$form, FormStateInterface $fo * Implements template_preprocess_views_view_fields(). */ function dkan_admin_preprocess_views_view_field(&$vars) { - // To access current row entity. - $entity = $vars['row']->_entity; - $entity_id = $entity->id(); - $uuid = $entity->uuid->value; - - // To access entities from relationship. - // $entities = $vars['row']->_relationship_entities;. if (isset($vars['view']) && ($vars['view']->id() == 'dkan_content') && ($vars['view']->current_display == 'page_1')) { + // To access current row entity. + $entity = $vars['row']->_entity; + $entity_id = $entity->id(); + $uuid = $entity->uuid->value; + + // To access entities from relationship. + // $entities = $vars['row']->_relationship_entities;. + if (isset($vars['view']->field) && (count($vars['view']->field) > 0)) { if ($vars['field']->field == 'nothing' && $entity->field_data_type->value == 'dataset') { $vars['output'] = [