|
@@ -27,17 +27,16 @@ function popsu_preprocess_views_view_unformatted(&$variables) {
|
|
$variables['rows'][$id]['attributes']->addClass("popsu-node-".$c);
|
|
$variables['rows'][$id]['attributes']->addClass("popsu-node-".$c);
|
|
//kint($variables['rows'][$id]['content']["#row"]->nid);
|
|
//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);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ // 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);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -70,9 +69,18 @@ function popsu_preprocess_region(&$variables) {
|
|
/**
|
|
/**
|
|
* Implements hook_preprocess_block().
|
|
* Implements hook_preprocess_block().
|
|
*/
|
|
*/
|
|
-// function popsu_preprocess_block(&$variables) {
|
|
|
|
-// $t="t";
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
|
|
+function popsu_preprocess_views_view_fields(&$variables){
|
|
|
|
+
|
|
|
|
+ $entity = $variables['row']->_entity;
|
|
|
|
+ if($entity->hasField('field_programme')){
|
|
|
|
+ $target_id = $entity->get('field_programme')->getString();
|
|
|
|
+ // kint($variables);die();
|
|
|
|
+ // $variables['row']['attributes'] = new Attribute();
|
|
|
|
+ // $variables['row']['attributes']->addClass("pouet-node-".$target_id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
|
|
function popsu_preprocess_views_view_field(&$variables){
|
|
function popsu_preprocess_views_view_field(&$variables){
|
|
// check if link to entoty option is true
|
|
// check if link to entoty option is true
|
|
@@ -80,14 +88,16 @@ function popsu_preprocess_views_view_field(&$variables){
|
|
if (isset($settings['link_to_entity']) && $settings['link_to_entity']) {
|
|
if (isset($settings['link_to_entity']) && $settings['link_to_entity']) {
|
|
// get the entity and build the classes
|
|
// get the entity and build the classes
|
|
$entity = $variables['row']->_entity;
|
|
$entity = $variables['row']->_entity;
|
|
- // $target_id = $entity;
|
|
|
|
|
|
+
|
|
// build new classes
|
|
// build new classes
|
|
$new_classes = array(
|
|
$new_classes = array(
|
|
$entity->getEntityTypeId(),
|
|
$entity->getEntityTypeId(),
|
|
$entity->getEntityTypeId().'-'.$entity->bundle(),
|
|
$entity->getEntityTypeId().'-'.$entity->bundle(),
|
|
- $entity->getEntityTypeId().'-'.$entity->bundle().'-'.$entity->id()
|
|
|
|
|
|
+ $entity->getEntityTypeId().'-'.$entity->bundle().'-'.$entity->id(),
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
// get the entity link and url
|
|
// get the entity link and url
|
|
$link = $entity->toLink();
|
|
$link = $entity->toLink();
|
|
$url = $entity->toLink()->getUrl();
|
|
$url = $entity->toLink()->getUrl();
|