You are here

function _popup_node in Popup 8

Same name and namespace in other branches
  1. 7 includes/popup.api.inc \_popup_node()
  2. 7.x includes/popup.api.inc \_popup_node()
  3. 6.x includes/popup.api.inc \_popup_node()
1 call to _popup_node()
_popup_nodereference_render_group in modules/popup_nodereference/includes/popup_nodereference.util.inc

File

includes/popup.api.inc, line 298

Code

function _popup_node($attributes, $return = FALSE) {
  $node = Node::load($attributes['node']);
  if ($node) {
    $title = isset($attributes['title']) && $attributes['title'] ? $attributes['title'] : $node->title;
    if ($return == 'title') {
      return $title;
    }
    $mode = isset($attributes['teaser']) && $attributes['teaser'] ? 'teaser' : 'full';
    $node_view = node_view($node, $mode);
    $body = \Drupal::service('renderer')
      ->render($node_view);
    if ($return == 'body') {
      return $body;
    }
    return popup_element($title, $body, $attributes);
  }
}