function views_ui_autocomplete_tag
Same name in other branches
- 7.x-3.x includes/admin.inc \views_ui_autocomplete_tag()
Page callback for views tag autocomplete
1 string reference to 'views_ui_autocomplete_tag'
File
-
includes/
admin.inc, line 3818
Code
function views_ui_autocomplete_tag($string = '') {
$matches = array();
// get matches from default views:
views_include('view');
$views = views_discover_default_views();
foreach ($views as $view) {
if (!empty($view->tag) && strpos($view->tag, $string) === 0) {
$matches[$view->tag] = $view->tag;
}
}
if ($string) {
$result = db_query_range("SELECT DISTINCT tag FROM {views_view} WHERE LOWER(tag) LIKE LOWER('%s%%')", $string, 0, 10 - count($matches));
while ($view = db_fetch_object($result)) {
$matches[$view->tag] = check_plain($view->tag);
}
}
drupal_json($matches);
}