Skip to content

Instantly share code, notes, and snippets.

View damiankloip's full-sized avatar

Damian Lee damiankloip

View GitHub Profile
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 8d6e28c..db55db8 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -7,9 +7,9 @@
namespace Drupal\Core;
+use Drupal\Component\Utility\Settings;
use Drupal\Component\PhpStorage\PhpStorageFactory;
<?php
/**
* @file
* Contains \Drupal\views\ViewResult.
*/
namespace Drupal\views;
/**
<?php
/**
* @file
* Contains \Drupal\Core\Entity\EntityIterator.
*/
namespace Drupal\Core\Entity;
/**
/**
* Returns the plugin category that this display requires.
*
* This can be used for filtering views plugins. E.g. If a plugin category of
* 'foo' is specified, only plugins with no 'types' declared or 'types'
* containing 'foo'. If you have a type of bar, this plugin will not be used.
* This is applicable for style, row, access, cache, and exposed_form plugins.
*
* @return string
* The required category type. Defaults to 'normal'.
<?php
$times = array();
for ($i = 0; $i <= 10; $i++) {
$view = views_get_view('frontpage');
timer_start('damian');
for ($i = 0; $i <= 100; $i++) {
$view->setDisplay('page_1');
diff --git a/core/modules/views/lib/Drupal/views/ViewsDataCache.php b/core/modules/views/lib/Drupal/views/ViewsDataCache.php
index bc5bd02..611e117 100644
--- a/core/modules/views/lib/Drupal/views/ViewsDataCache.php
+++ b/core/modules/views/lib/Drupal/views/ViewsDataCache.php
@@ -128,10 +128,10 @@ public function get($key = NULL) {
}
if (isset($this->storage[$key])) {
- if (!$from_cache) {
+ if (!$from_cache && !isset($this->requestedTables[$key])) {
/**
* Retrieves a list of fields for the current display.
*
* This also takes into account any associated relationships, if they exist.
*
* @param bool $groupable_only
* (optional) TRUE to only return an array of field labels from handlers
* that support the use_string_group_by method, defaults to FALSE.
*
* @return array
diff --git a/lib/Drupal/views_field_view/Plugin/views/field/View.php b/lib/Drupal/views_field_view/Plugin/views/field/View.php
index 567667d..e3b0833 100644
--- a/lib/Drupal/views_field_view/Plugin/views/field/View.php
+++ b/lib/Drupal/views_field_view/Plugin/views/field/View.php
@@ -23,6 +23,34 @@ use Drupal\views\Plugin\views\field\FieldPluginBase;
class View extends FieldPluginBase {
/**
+ * Keeps track of which views are currently being run.
+ *
<?php
return is_object($data) && array_filter($this->supportedInterfaceOrClass, function($name) use ($data) {
return $data instanceof $name;
});
<?php
protected function supportedInterfaceOrClass($data, $format = NULL) {
// If there is a format passed in and specified on the class, check if it is
// correct.
if (isset($format) && isset($this->format) && !in_array($format, $this->format)) {
return FALSE;
}
if (is_object($data)) {