Skip to content
Snippets Groups Projects
Commit 6dd12bd3 authored by Konstantinos Platis's avatar Konstantinos Platis
Browse files

Added try-catch and if conditional for checking block

parent 97c03ff8
No related branches found
No related tags found
2 merge requests!40Merge v2.5.0 to master branch,!38Resolve "CERN base throws error when cernoverride theme is enabled"
...@@ -57,15 +57,23 @@ function cernbase_preprocess_page(&$variables) { ...@@ -57,15 +57,23 @@ function cernbase_preprocess_page(&$variables) {
} }
} }
$view_id = \Drupal::routeMatch()->getParameter('view_id'); try{
//if the page is a view and renders the page title $view_id = \Drupal::routeMatch()->getParameter('view_id');
if ( $view_id && $variables['page']['content']['cernclean_page_title']){ //if the page is a view and renders the page title
$view = \Drupal\views\Views::getView($view_id); if (array_key_exists('cernclean_page_title', $variables['page']['content'])){
if( !empty($view->getTitle())){ if ( $view_id && $variables['page']['content']['cernclean_page_title']){
unset($variables['page']['content']['cernclean_page_title']); $view = \Drupal\views\Views::getView($view_id);
} if( !empty($view->getTitle())){
unset($variables['page']['content']['cernclean_page_title']);
}
}
}
}
catch (Exception $e){
\Drupal::logger('type')->error($e->getMessage());
}
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment