You are here

function image_gallery_plugin_display_image_gallery::render in Image 6

Same name and namespace in other branches
  1. 7 contrib/image_gallery/views/image_gallery_plugin_display_image_gallery.inc \image_gallery_plugin_display_image_gallery::render()

Embed the gallery term view above the normal rendering of this view.

File

contrib/image_gallery/views/image_gallery_plugin_display_image_gallery.inc, line 32

Class

image_gallery_plugin_display_image_gallery
The plugin that handles a full page.

Code

function render() {

  // Check the current gallery view has a tid argument.
  if (isset($this->view->argument['tid'])) {
    $args = $this->view->argument['tid']->value;

    // No argument means we are at the top-level gallery.
    // We need to pass an argument of 0 to the gallery terms view so it
    // shows only the top level.
    if (count($args) == 0) {

      // Have to pass as string, otherwise it gets eaten by views validation.
      $args = array(
        0 => '0',
      );
    }
    $this->gallery_terms_view = views_get_view('image_gallery_terms');

    // Tack THIS view onto the gallery terms view. We don't do anything with
    // this yet, but other handlers might need it.
    $this->gallery_terms_view->embedding_view =& $this->view;
    $output = $this->gallery_terms_view
      ->preview('default', $args);
  }

  // Render this view as normal.
  $output .= parent::render();
  return $output;
}