fixed views_row programme classes bug #2103
This commit is contained in:
parent
e659a25172
commit
efaecf9ef3
@ -1 +1 @@
|
|||||||
Subproject commit 5069345d9dffca8ff935d7a01d2bc97a1272f063
|
Subproject commit 27bf1819cdd12b38553d91c8f95eaf2659902b99
|
@ -98,9 +98,11 @@ function popsu_preprocess_views_view_unformatted(&$variables) {
|
|||||||
$r = $row['content']['#row'];
|
$r = $row['content']['#row'];
|
||||||
$entity = $r->_entity;
|
$entity = $r->_entity;
|
||||||
if ($entity->hasField('field_programme') && $entity->get('field_programme')->getString() != "" ) {
|
if ($entity->hasField('field_programme') && $entity->get('field_programme')->getString() != "" ) {
|
||||||
$c = $entity->get('field_programme')->getString();
|
|
||||||
$variables['rows'][$id]['attributes'] = new Attribute();
|
$variables['rows'][$id]['attributes'] = new Attribute();
|
||||||
$variables['rows'][$id]['attributes']->addClass("programme-".$c);
|
$referenced_entities = $entity->get('field_programme')->referencedEntities();
|
||||||
|
foreach ($referenced_entities as $ref_entity) {
|
||||||
|
$variables['rows'][$id]['attributes']->addClass("programme-".$ref_entity->id());
|
||||||
|
}
|
||||||
if ($entity->hasField('field_type_de_ressource') && $entity->get('field_type_de_ressource')->getString() == "74" ) {
|
if ($entity->hasField('field_type_de_ressource') && $entity->get('field_type_de_ressource')->getString() == "74" ) {
|
||||||
$type = $entity->get('field_type_de_ressource')->getString();
|
$type = $entity->get('field_type_de_ressource')->getString();
|
||||||
$variables['rows'][$id]['attributes']['class'][] = "type-".$type;
|
$variables['rows'][$id]['attributes']['class'][] = "type-".$type;
|
||||||
@ -181,7 +183,7 @@ function popsu_preprocess_views_view_grid(&$variables){
|
|||||||
function popsu_preprocess_views_view_field(&$variables){
|
function popsu_preprocess_views_view_field(&$variables){
|
||||||
// check if link to entity option is true
|
// check if link to entity option is true
|
||||||
$settings = isset($variables['field']->options['settings']) ? $variables['field']->options['settings'] : false;
|
$settings = isset($variables['field']->options['settings']) ? $variables['field']->options['settings'] : false;
|
||||||
if ($settings && isset($settings['link_to_entity']) && $settings['link_to_entity']) {
|
if ($settings && isset($settings['link']) && $settings['link']) {
|
||||||
// get the entity and build the classes
|
// get the entity and build the classes
|
||||||
$entity = $variables['row']->_entity;
|
$entity = $variables['row']->_entity;
|
||||||
// $entity_type = $entity->getEntityType();
|
// $entity_type = $entity->getEntityType();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user