62 lines
1.7 KiB
Plaintext
62 lines
1.7 KiB
Plaintext
<?php
|
|
/*
|
|
* @files
|
|
* Theme Template Funtions
|
|
*/
|
|
|
|
use Drupal\Core\Template\Attribute;
|
|
|
|
/* implements template_preprocess_views_view() */
|
|
|
|
// function popsu_preprocess_views_view(&$vars) {
|
|
// $view = $vars['view'];
|
|
// kint($view);die();
|
|
// }
|
|
|
|
|
|
/* implements template_preprocess_views_view_unformatted() */
|
|
|
|
function popsu_preprocess_views_view_unformatted(&$variables) {
|
|
|
|
$view = $variables['view'];
|
|
if($view->id() == "programmes"){
|
|
$rows = $variables['rows'];
|
|
foreach ($rows as $id => $row) {
|
|
$variables['rows'][$id]['attributes'] = new Attribute();
|
|
$c = $variables['rows'][$id]['content']["#row"]->nid;
|
|
$variables['rows'][$id]['attributes']->addClass("popsu-node-".$c);
|
|
//kint($variables['rows'][$id]['content']["#row"]->nid);
|
|
}
|
|
|
|
|
|
}else{
|
|
if ($view->current_display == "block_1") {
|
|
$rows = $variables['rows'];
|
|
foreach ($rows as $id => $row) {
|
|
$variables['rows'][$id]['attributes'] = new Attribute();
|
|
$c = $variables['rows'][$id]['content']["#row"]->nid;
|
|
$variables['rows'][$id]['attributes']->addClass("popsu-node-".$c);
|
|
}
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
/* implements template_preprocess_region() */
|
|
|
|
function popsu_preprocess_region(&$variables) {
|
|
$r = $variables['region'];
|
|
if (isset($variables['region'])) {
|
|
$variables['attributes']['class'][] = $variables['region'].'_container';
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// function popsu_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {
|
|
// $elem = $variables;
|
|
// //$suggestions[] = 'views_view__headerView';
|
|
// /*if($variables['elements']['#id'] == 'customsearchform'){
|
|
// $suggestions[] = 'block__custom_search_form';
|
|
// }*/
|
|
// } |