function context_field_autocomplete in Context Field 7
Return all contextes that exist as a menu callback.
4 string references to 'context_field_autocomplete'
- context_field_field_insert in ./
context_field.module - Implements hook_field_insert().
- context_field_field_widget_form in ./
context_field.module - Implements hook_field_widget_form().
- context_field_field_widget_settings_form in ./
context_field.module - Provide widget level settings.
- context_field_menu in ./
context_field.module - Implements hook_menu().
File
- ./
context_field.module, line 275 - Context Field
Code
function context_field_autocomplete($cat, $string = '') {
$contexts = context_load();
$context_options[''] = t("No Context Selected");
foreach ($contexts as $key => $context) {
if (isset($context->conditions['context_field']['values'][1]) && isset($context->conditions['context_field']['options']['context_field_category']) && $context->conditions['context_field']['options']['context_field_category'] == $cat) {
$canidate = "{$context->description} [{$key}]";
$canidates[$canidate] = check_plain($canidate);
}
}
$matches = preg_grep("/{$string}/", $canidates);
drupal_json_output($matches);
}