64 lines
1.6 KiB
Plaintext
64 lines
1.6 KiB
Plaintext
<?php
|
|
/*
|
|
* @files
|
|
* Theme Template Funtions
|
|
*/
|
|
|
|
use Drupal\Core\Template\Attribute;
|
|
|
|
|
|
/* 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);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
$rows = $variables['rows'];
|
|
$style = $view->style_plugin;
|
|
$options = $style->options;
|
|
$variables['default_row_class'] = !empty($options['default_row_class']);
|
|
*/
|
|
/*
|
|
foreach ($rows as $id => $row) {
|
|
$variables['rows'][$id] = array();
|
|
$variables['rows'][$id]['content'] = $row;
|
|
$variables['rows'][$id]['attributes'] = new Attribute();
|
|
if ($row_class = $view->style_plugin
|
|
->getRowClass($id)) {
|
|
$variables['rows'][$id]['attributes']
|
|
->addClass($row_class);
|
|
}
|
|
}
|
|
*/
|
|
};
|
|
|
|
|
|
/**
|
|
* Implements hook_preprocess_block().
|
|
*/
|
|
// function popsu_preprocess_block(&$variables) {
|
|
// $t="t";
|
|
// } |