|
@@ -43,12 +43,10 @@ function popsu_preprocess_field(&$variables){
|
|
|
$variables['attributes']['class'][] = 'crop';
|
|
|
}
|
|
|
if($element["#field_name"] == "field_programme"){
|
|
|
-
|
|
|
- foreach ($variables["items"] as $id => $item) {
|
|
|
- $item['attributes']['class'] = new Attribute();
|
|
|
- $c = $item['content']['#options']['entity']->nid->getString();
|
|
|
- $item['attributes']->addClass("programme-".$c);
|
|
|
- // kint($variables["items"]);die();
|
|
|
+ foreach ($element["#items"]->getIterator() as $id => $item) {
|
|
|
+ $nid = $item->getValue()['target_id'];
|
|
|
+ $variables['items'][$id]['attributes']['class'] = new Attribute();
|
|
|
+ $variables['items'][$id]['attributes']->addClass("programme-".$nid);
|
|
|
}
|
|
|
}
|
|
|
}
|