Created
December 24, 2016 15:42
-
-
Save cyberlex404/dddb0f470015b6a0ef318372ad3c8a75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function getViewRender($views_id, $display_id, $arguments = [], $class = NULL, $is_title = TRUE) { | |
if(is_null($class)) { | |
$class = $views_id . '-' .$display_id; | |
} | |
$build = [ | |
'#prefix' => '<div class="' . $class . '">', | |
'#suffix' => '</div>', | |
]; | |
// get the view machine id | |
$view = Views::getView($views_id); | |
// set the display machine id | |
$view->setDisplay($display_id); | |
// set arguments/filter values | |
$view->setArguments($arguments); | |
// dpm($view->getStyle()); | |
$title = $view->getTitle(); | |
//dpm($title); | |
if(isset($title) && $is_title) { | |
$attributes = new Attribute(['class' => ['tab-header']]); | |
$build['header'] = [ | |
'#type' => 'html_tag', | |
'#tag' => 'h3', | |
'#value' => $title, | |
'#attributes' => $attributes, | |
]; | |
} | |
$build['content'] = $view->render(); | |
return $build; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment