Skip to content

Commit

Permalink
Not all views display entities (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
thierrydallacroce authored Feb 19, 2020
1 parent a8b5fad commit a6b383a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions modules/custom/dkan_admin/dkan_admin.module
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = [
Expand Down

0 comments on commit a6b383a

Please sign in to comment.