function features_autocomplete_packages in Features 7
Same name and namespace in other branches
- 7.2 features.admin.inc \features_autocomplete_packages()
Page callback: Autocomplete field for features package.
Parameters
$search_string: The char or string that user have written in autocomplete field, this is the string this function uses for filter.
See also
1 string reference to 'features_autocomplete_packages'
- features_menu in ./
features.module - Implements hook_menu().
File
- ./
features.admin.inc, line 886 - @todo.
Code
function features_autocomplete_packages($search_string) {
$matched_packages = array();
//fetch all modules that are features and copy the package name into a new array.
foreach (features_get_features(NULL, TRUE) as $value) {
if (preg_match('/' . $search_string . '/i', $value->info['package'])) {
$matched_packages[$value->info['package']] = $value->info['package'];
}
}
//removes duplicated package, we wont a list of all unique packages.
$matched_packages = array_unique($matched_packages);
drupal_json_output($matched_packages);
}