summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Great Git Migration2010-12-28 16:54:28 +0000
committerThe Great Git Migration2010-12-28 16:54:28 +0000
commit514a15c7a4df442593a4c3de210be46e0916d5fd (patch)
tree4d3b8802d349cf289f05cf7cae7412cffcf97547
parent07c99f7e0255ff376d7e277de5208b25f18fa8ef (diff)
This commit was manufactured as part of Drupal's Great Git Migration to7.x-1.0
create tag 'DRUPAL-7--1-0'. Sprout from master 2010-12-28 16:54:27 UTC Emil Stjerneman <emil@stjerneman.com> 'by anon: Added SQL condition' Cherrypick from master 2010-12-22 20:28:02 UTC Emil Stjerneman <emil@stjerneman.com> 'First commit for D7 release': plugins/linkit_views/linkit_views.info plugins/linkit_views/linkit_views.module
-rw-r--r--plugins/linkit_views/linkit_views.info13
-rw-r--r--plugins/linkit_views/linkit_views.module51
2 files changed, 64 insertions, 0 deletions
diff --git a/plugins/linkit_views/linkit_views.info b/plugins/linkit_views/linkit_views.info
new file mode 100644
index 0000000..ed69693
--- /dev/null
+++ b/plugins/linkit_views/linkit_views.info
@@ -0,0 +1,13 @@
+; $Id$
+name = Linkit Views
+description = Extend Linkit with views links
+core = 6.x
+package = Linkit
+dependencies[] = "linkit"
+dependencies[] = "views"
+; Information added by drupal.org packaging script on 2010-11-26
+version = "6.x-1.x-dev"
+core = "6.x"
+project = "linkit"
+datestamp = "1290730629"
+
diff --git a/plugins/linkit_views/linkit_views.module b/plugins/linkit_views/linkit_views.module
new file mode 100644
index 0000000..31b393d
--- /dev/null
+++ b/plugins/linkit_views/linkit_views.module
@@ -0,0 +1,51 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Extend Linkit with views links.
+ */
+
+
+/**
+ * Implementation of hook_linkit_load_plugins().
+ */
+function linkit_views_linkit_load_plugins($string) {
+ $matches = array();
+
+ // Get all page displays in view, and create temporary table
+ $temp_table = 'CREATE TEMPORARY TABLE {linkit_tmp_view_table} (title VARCHAR(128) NOT NULL, path VARCHAR(128) NOT NULL)';
+ db_query($temp_table);
+
+ // Get all displays that are "page" and their path
+ $result = db_query("SELECT w.name, wd.display_options FROM {views_view} AS w INNER JOIN {views_display} AS wd ON w.vid = wd.vid WHERE wd.display_plugin = '%s'", 'page');
+ while ($node = db_fetch_object($result)) {
+ $optinos = unserialize($node->display_options);
+ db_query("INSERT INTO {linkit_tmp_view_table} (title, path) VALUES ('%s', '%s')", $node->name, $optinos['path']);
+ }
+
+ $result = db_query_range("SELECT * FROM {linkit_tmp_view_table} WHERE LOWER(path) LIKE LOWER('%%%s%%')", $string, 0, 10);
+ while ($node = db_fetch_object($result)) {
+ $matches['view'][] = array(
+ 'title' => $node->path,
+ 'path' => base_path() . $node->path,
+ 'information' => array(
+ 'type' => 'Views',
+ ),
+ );
+ }
+
+ return $matches;
+}
+
+/**
+ * Implementation of hook_linkit_info_plugins().
+ *
+ * This is used by linkit_permissions
+ */
+function linkit_views_linkit_info_plugins() {
+ $return['linkit_views'] = array(
+ 'type' => 'views',
+ );
+ return $return;
+} \ No newline at end of file