Snippets

Oleksiy Kalinichenko Drupal 8.6.* custom fix.

Created by Oleksiy Kalinichenko
diff -rupN a/modules/views/src/Plugin/views/cache/CachePluginBase.php b/modules/views/src/Plugin/views/cache/CachePluginBase.php
--- a/modules/views/src/Plugin/views/cache/CachePluginBase.php	2018-08-01 23:50:42.000000000 +0300
+++ b/modules/views/src/Plugin/views/cache/CachePluginBase.php	2018-08-16 14:02:31.000000000 +0300
@@ -311,7 +311,8 @@ abstract class CachePluginBase extends P
     $tags = !empty($row->_entity) ? $row->_entity->getCacheTags() : [];

     if (!empty($row->_relationship_entities)) {
-      foreach ($row->_relationship_entities as $entity) {
+      // Custom Deprexis' fallback to fix broken relation content.
+      foreach (array_filter($row->_relationship_entities) as $entity) {
         $tags = Cache::mergeTags($tags, $entity->getCacheTags());
       }
     }
diff -rupN a/modules/views/src/Plugin/views/query/Sql.php b/modules/views/src/Plugin/views/query/Sql.php
--- a/modules/views/src/Plugin/views/query/Sql.php	2018-08-16 12:59:17.000000000 +0300
+++ b/modules/views/src/Plugin/views/query/Sql.php	2018-08-16 13:53:27.000000000 +0300
@@ -1694,6 +1694,9 @@ class Sql extends QueryPluginBase {
       }
     }

+    // Custom Deprexis' fallback to fix broken relation content.
+    $entities = array_values(array_filter($entities));
+
     return $entities;
   }

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.