You are here

function viewsreference_views_pre_render in Views Reference Field 8.2

Implements hook_views_pre_render().

File

./viewsreference.module, line 89
Defines a field type to embed views in an entity reference field.

Code

function viewsreference_views_pre_render($view) {

  // If using AJAX, forward the viewsreference data and settings in the request.
  if (isset($view->element['#viewsreference']) && $view
    ->ajaxEnabled() && empty($view->is_attachment) && empty($view->live_preview)) {
    $view->element['#attached']['drupalSettings']['views']['ajaxViews']['views_dom_id:' . $view->dom_id]['viewsreference'] = $view->element['#viewsreference'];
  }
  return $view;
}