Skip to content

Instantly share code, notes, and snippets.

@damiankloip
Created July 26, 2012 19:02
Show Gist options
  • Save damiankloip/3183827 to your computer and use it in GitHub Desktop.
Save damiankloip/3183827 to your computer and use it in GitHub Desktop.
diff --git a/includes/plugins.inc b/includes/plugins.inc
index 9618f8a..8e31e0a 100644
--- a/includes/plugins.inc
+++ b/includes/plugins.inc
@@ -19,7 +19,7 @@ function views_views_plugins() {
'default' => array(
'title' => t('Master'),
'help' => t('Default settings for this view.'),
- 'class' => 'Drupal\views\Plugins\views\display\Default',
+ 'class' => 'Drupal\views\Plugins\views\display\DefaultDisplay',
'theme' => 'views_view',
'no ui' => TRUE,
'no remove' => TRUE,
@@ -445,9 +445,9 @@ function views_discover_plugins() {
if (!isset($def['path'])) {
$def['path'] = $path;
}
- if (!isset($def['file'])) {
- $def['file'] = $def['handler'] . '.inc';
- }
+ // if (!isset($def['file'])) {
+ // $def['file'] = $def['handler'] . '.inc';
+ // }
if (!isset($def['parent'])) {
$def['parent'] = 'parent';
}
diff --git a/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php b/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php
new file mode 100644
index 0000000..6843242
--- /dev/null
+++ b/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\views\Plugins\views\display\DefaultDisplay.
+ */
+
+namespace Drupal\views\Plugins\views\display;
+
+/**
+ * A plugin to handle defaults on a view.
+ *
+ * @ingroup views_display_plugins
+ */
+class DefaultDisplay extends DisplayPluginBase {
+ /**
+ * Determine if this display is the 'default' display which contains
+ * fallback settings
+ */
+ function is_default_display() { return TRUE; }
+
+ /**
+ * The default execute handler fully renders the view.
+ *
+ * For the simplest use:
+ * @code
+ * $output = $view->execute_display('default', $args);
+ * @endcode
+ *
+ * For more complex usages, a view can be partially built:
+ * @code
+ * $view->set_arguments($args);
+ * $view->build('default'); // Build the query
+ * $view->pre_execute(); // Pre-execute the query.
+ * $view->execute(); // Run the query
+ * $output = $view->render(); // Render the view
+ * @endcode
+ *
+ * If short circuited at any point, look in $view->build_info for
+ * information about the query. After execute, look in $view->result
+ * for the array of objects returned from db_query.
+ *
+ * You can also do:
+ * @code
+ * $view->set_arguments($args);
+ * $output = $view->render('default'); // Render the view
+ * @endcode
+ *
+ * This illustrates that render is smart enough to call build and execute
+ * if these items have not already been accomplished.
+ *
+ * Note that execute also must accomplish other tasks, such
+ * as setting page titles, breadcrumbs, and generating exposed filter
+ * data if necessary.
+ */
+ function execute() {
+ return $this->view->render($this->display->id);
+ }
+}
diff --git a/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php b/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php
index 17c05d5..910dbfc 100644
--- a/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php
+++ b/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php
@@ -18,7 +18,7 @@ namespace Drupal\views\Plugins\views\filter;
*
* @ingroup views_filter_handlers
*/
-class BooleanOperatorString extends BooleanOperatorFilter {
+class BooleanOperatorString extends BooleanOperator {
function query() {
$this->ensure_my_table();
$where = "$this->table_alias.$this->real_field ";
diff --git a/lib/Drupal/views/View.php b/lib/Drupal/views/View.php
index d2ef68e..5ac557f 100644
--- a/lib/Drupal/views/View.php
+++ b/lib/Drupal/views/View.php
@@ -9,6 +9,7 @@ namespace Drupal\views;
use Symfony\Component\HttpFoundation\Response;
use Drupal\views\Plugins\Type\QueryPluginManager;
+use Drupal\views\Plugins\Type\DisplayPluginManager;
/**
* @defgroup views_objects Objects that represent a View or part of a view
@@ -471,7 +472,8 @@ class View extends ViewsDbObject {
$this->display[$id] = clone $this->display[$id];
unset($this->display[$id]->handler);
}
- $this->display[$id]->handler = views_get_plugin('display', $this->display[$id]->display_plugin);
+ $plugin_manager = new DisplayPluginManager();
+ $this->display[$id]->handler = $plugin_manager->createInstance($this->display[$id]->display_plugin);
if (!empty($this->display[$id]->handler)) {
$this->display[$id]->handler->localization_keys = array($id);
// Initialize the new display handler with data.
@@ -578,7 +580,8 @@ class View extends ViewsDbObject {
$this->style_options = $this->display_handler->get_option('style_options');
}
- $this->style_plugin = views_get_plugin('style', $this->plugin_name);
+ $style_manager = new StylePluginManager();
+ $this->style_plugin = $style_manager->createInstance($this->plugin_name);
if (empty($this->style_plugin)) {
return FALSE;
diff --git a/views.module b/views.module
index 32d5739..28bd1cd 100644
--- a/views.module
+++ b/views.module
@@ -1339,10 +1339,10 @@ function views_get_localization_plugin() {
// Provide sane default values for the localization plugin.
if (empty($plugin)) {
if (module_exists('locale')) {
- $plugin = 'core';
+ $plugin = 'Core';
}
else {
- $plugin = 'none';
+ $plugin = 'None';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment