summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/help/api-tables.html
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/help/api-tables.html')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/help/api-tables.html32
1 files changed, 19 insertions, 13 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/help/api-tables.html b/kolab.org/www/drupal-7.15/sites/all/modules/views/help/api-tables.html
index 47af4ab..cafbbab 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/views/help/api-tables.html
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/help/api-tables.html
@@ -1,15 +1,21 @@
-Tables are described to Views via hook_views_data(), which returns an array of table information, keyed by the name of the table. For example, if your module is describing three tables, 'foo', 'bar' and 'baz', your array will look like this:
-<pre>$data = array(
- 'foo' =&gt; array(
- // ...info here...
- ),
- 'bar' =&gt; array(
- // ...info here...
- ),
- 'baz' =&gt; array(
- // ...info here...
- ),
-);
+Tables are described to Views by implementing hook_views_data(). This should be placed in MODULENAME.views.inc and it will be autoloaded (see <a href="topic:views/api">Views' API</a>). The hook implementation should return an array of table information, keyed by the name of the table. For example, if your module is describing three tables, 'foo', 'bar' and 'baz', your hook will look like this:
+<pre> /**
+ * Implements hook_views_data().
+ */
+ function MODULENAME_views_data() {
+ $data = array(
+ 'foo' =&gt; array(
+ // ...info about the table named 'foo'...
+ ),
+ 'bar' =&gt; array(
+ // ...info about the table named 'bar'...
+ ),
+ 'baz' =&gt; array(
+ // ...info about the table named 'baz'...
+ ),
+ );
+ return $data;
+ }
</pre>
The key should be the actual database name of the table (not including prefix), but it can be an alias as long as the join information (explained later) contains the real name of the table.
@@ -230,7 +236,7 @@ The following items are allowed in the field definition:
<dt>sort</dt>
<dd>A handler definition for the "Sort criteria" section, which will be used to add an ORDER BY clause to the view. The definition is an array; the contents of the array are completely up to the handler, other than the 'handler' definition. If omitted, handler will default to 'views_handler_sort'.</dd>
<dt>relationship</dt>
-<dd>A handler definition for the "Field" section, which is a way to bring in new or alternative base tables in the view. The definition is an array; the contents of the array are completely up to the handler, other than the 'handler' definition. If omitted, handler will default to 'views_handler_relationship'. The basic relationship handler requires 'base' and 'base field' to be set; 'base' and 'base field' represent the "right" half of the join that will use this field as the left side.</dd>
+<dd>A handler definition for the "Field" section, which is a way to bring in new or alternative base tables in the view. The definition is an array; the contents of the array are completely up to the handler, other than the 'handler' definition. If omitted, handler will default to 'views_handler_relationship'. All relationships need the 'base' to be set. The basic relationship handler also requires 'base field' to be set. 'base' and 'base field' represent the "right" half of the join that will use this field as the left side.</dd>
<dt>argument</dt>
<dd>A handler definition for the "Field" section, which is method of accepting user input from the URL or some other source. The definition is an array; the contents of the array are completely up to the handler, other than the 'handler' definition. If omitted, handler will default to 'views_handler_argument'.</dd>
</dl>