From 80c57f96ae07bbee045d879ac6cff6fdab80d7e6 Mon Sep 17 00:00:00 2001
From: zilverdistel <zilverdistel@zilverdistel.be>
Date: Sat, 26 Feb 2011 13:05:34 +0100
Subject: [PATCH 1/2] Issue #1071480 by zilverdistel:Added Query to the list of types
 of views plugins

---
 help/api-plugins.html |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/help/api-plugins.html b/help/api-plugins.html
index c0185b7..138eab2 100644
--- a/help/api-plugins.html
+++ b/help/api-plugins.html
@@ -1,6 +1,6 @@
 In Views, a plugin is a bit like a handler, but plugins are not directly responsible for building the query. Instead, they are objects that are used to display the view or make other modifications.
 
-There are 6 types of plugins in Views:
+There are 7 types of plugins in Views:
 <dl>
 <dt>Display</dt>
 <dd>Display plugins are responsible for controlling <strong>where</strong> a view lives. Page and block are the most common displays, as well as the ubiquitous 'default' display which is likely what will be embedded.</dd>
@@ -14,6 +14,8 @@ There are 6 types of plugins in Views:
 <dd>Validator plugins can ensure arguments are valid, and even do transformations on the arguments.</dd>
 <dt>Access</dt>
 <dd>Access plugins are responsible for controlling access to the view.</dd>
+<dt>Query</dt>
+<dd>Query plugins are responsible for fetching the data that is displayed by the view.</dd>
 </dl>
 
 Plugins are registered by implementing <strong>hook_views_plugins()</strong> in your modulename.views.inc file and returning an array of data.
-- 
1.7.1


From 6db5b5094a2ff08a1ea8a2b53d441e60911586f4 Mon Sep 17 00:00:00 2001
From: zilverdistel <zilverdistel@zilverdistel.be>
Date: Sat, 26 Feb 2011 14:15:22 +0100
Subject: [PATCH 2/2] Issue #1071480 by zilverdistel: Added a page "Implementing a views
 query plugin" and included the basic document structure

---
 help/api-plugins-query.html |   43 +++++++++++++++++++++++++++++++++++++++++++
 help/views.help.ini         |    5 +++++
 2 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 help/api-plugins-query.html

diff --git a/help/api-plugins-query.html b/help/api-plugins-query.html
new file mode 100644
index 0000000..d4da8e7
--- /dev/null
+++ b/help/api-plugins-query.html
@@ -0,0 +1,43 @@
+<h3>Describing your data</h3>
+
+Implement hook_views_data().
+
+
+<h3>Extending the views_plugin_query class</h3>
+
+To allow views to pull data from an external source, you need to extend the class views_plugin_query. 
+If you're looking for an example, the default query plugin that views uses is views_plugin_query_default.
+
+<pre>
+class example_views_plugin_query extends views_plugin_query {
+
+}
+</pre>
+
+
+<h3>Altering the query</h3>
+
+At a minimum you need to implement the following methods:
+
+<ul>
+<li>add_where(&$view)</li>
+<li>...</li>
+</ul>
+
+Optional methods:
+
+<ul>
+<li>...</li>
+</ul>
+
+
+<h3>Executing the query</h3>
+
+Implement the method execute(&$view). Values to set: 
+
+<ul>
+<li>$view->result</li>
+<li>$view->total_rows</li>
+<li>$view->execute_time</li>
+<li>$view->pager['current_page']</li>
+</ul>
\ No newline at end of file
diff --git a/help/views.help.ini b/help/views.help.ini
index 51a7264..cf2057c 100644
--- a/help/views.help.ini
+++ b/help/views.help.ini
@@ -193,6 +193,11 @@ title = "How Views plugins work"
 weight = -40
 parent = api
 
+[api-plugins-query]
+title = "Implementing a views query plugin"
+weight = 100
+parent = api-plugins
+
 [api-upgrading]
 title = "Upgrading your module Views 1 to Views 2"
 parent = api
-- 
1.7.1

