function linkit_views_linkit_load_plugins in Linkit 6
Implementation of hook_linkit_load_plugins().
File
- plugins/
linkit_views/ linkit_views.module, line 11 - Extend Linkit with views links.
Code
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("SELECT * FROM {linkit_tmp_view_table} WHERE LOWER(path) LIKE LOWER('%%%s%%')", $string);
while ($node = db_fetch_object($result)) {
$matches['view'][] = array(
'title' => $node->path,
'path' => base_path() . $node->path,
'information' => array(
'type' => 'Views',
),
);
}
return $matches;
}