Same name in other branches
- 7.x-3.x plugins/QuickNodeContent.inc \QuickNodeContent::render()
Overrides QuickContentRenderableInterface::render
Fichier
-
src/
Plugin/ QuickContent/ QuickNodeContent.php, line 67
Classe
- QuickNodeContent
- Class for tab content of type "node" - this is for rendering a node as tab content. @QuicktabFormat{ id = "quicknodecontent" }
Namespace
Drupal\quicktabs\Plugin\QuickContentCode
public function render($hide_empty = FALSE, $args = array()) {
if ($this->rendered_content) {
return $this->rendered_content;
}
$item = $this->settings;
if (!empty($args)) {
// The args have been passed in from an ajax request.
// The first element of the args array is the qt_name, which we don't need
// for this content type.
array_shift($args);
list($item['nid'], $item['view_mode'], $item['hide_title']) = $args;
}
$output = array();
if (isset($item['nid'])) {
$node = \Drupal::entityManager()->getStorage('node')
->load($item['nid']);
if (!empty($node)) {
if (node_access('view', $node)) {
$buildmode = $item['view_mode'];
$nstruct = node_view($node, $buildmode);
if ($item['hide_title']) {
$nstruct['#node']->title = NULL;
}
$output = $nstruct;
}
elseif (!$hide_empty) {
$output = array(
'#markup' => theme('quicktabs_tab_access_denied', array(
'tab' => $item,
)),
);
}
}
}
return $output;
}