function workbench_access_is_active_autocomplete in Workbench Access 7
Determines is the current path is an autocomplete request.
Return value
TRUE or FALSE, indicating that we should alter the query.
1 call to workbench_access_is_active_autocomplete()
- workbench_access_query_term_access_alter in modules/
taxonomy.workbench_access.inc - Implements hook_query_TAG_alter().
File
- ./
workbench_access.module, line 2118 - Workbench Access module file.
Code
function workbench_access_is_active_autocomplete() {
$result =& drupal_static(__FUNCTION__);
if (isset($result)) {
return $result;
}
// Default to FALSE.
$result = FALSE;
// Are we running an autocomplete check?
// For some reason, calling menu_get_item() on a taxonomy page causes
// infinite recursion. So we have to simulate that function.
// See http://drupal.org/node/1187424#comment-5194746 for the report.
$page_arguments = array();
for ($i = 0; $i < 4; $i++) {
$page_arguments[$i] = arg($i);
}
$path = $page_arguments[0] . '/' . $page_arguments[1];
// If the path is wrong, or the arguments are not provided, then we cannot
// safely alter the term query.
if ($path != 'workbench_access/taxonomy_autocomplete' || empty($page_arguments[2]) || empty($page_arguments[3])) {
return $result;
}
// Check the field.
$field = $page_arguments[2];
$node_type = $page_arguments[3];
$fields = workbench_access_get_assigned_fields($node_type);
if (isset($fields[$field])) {
$result = TRUE;
}
return $result;
}