This commit was manufactured as part of Drupal's Great Git Migration to

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
parent 07c99f7e
; $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"
<?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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment