views_ui_autocomplete_tag($string = '')Page callback for views tag autocomplete
contributions/views/includes/admin.inc, line 2838
<?php
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);
}
?>