You are here

function i18n_book_navigation_i18n_book_nav_content_type_render in Book translation 7.2

Implements hook_PLUGIN_content_type_render().

File

plugins/content_types/i18n_book_nav.inc, line 27

Code

function i18n_book_navigation_i18n_book_nav_content_type_render($subtype, $conf, $panel_args, $context) {
  $node = isset($context->data) ? clone $context->data : NULL;
  $block = new stdClass();
  $block->module = 'i18n_book_nav';
  $block->title = t('i18n Book navigation');
  if ($node) {

    // The node view hook contains the logic for rendering the book navigation.
    i18n_book_navigation_node_view($node, 'full');

    // If nothing was added to the render array, we fall back to the default
    // Book module logic.
    if (!isset($node->content['book_navigation'])) {
      book_node_view($node, 'full');
    }
    $block->content = isset($node->content['book_navigation']) ? $node->content['book_navigation'] : '';
    $block->delta = $node->nid;
  }
  else {
    $block->content = t('Book navigation goes here.');
    $block->delta = 'unknown';
  }
  return $block;
}