function _mpac_get_matches_for_aliases in Multi-path autocomplete 7
Helper function to find all url aliases containing the given title in their destination string.
Parameters
$title: The title to search for.
1 call to _mpac_get_matches_for_aliases()
- mpac_autocomplete in ./
mpac.module - Find nodes, shortcuts and URL aliases based on title.
File
- ./
mpac.module, line 184 - Find node paths on menu item creation via autocomplete.
Code
function _mpac_get_matches_for_aliases($title = '') {
$matches = array();
if ($title == '') {
return $matches;
}
$query = db_select('url_alias')
->extend('PagerDefault');
$query
->condition('alias', '%' . db_like($title) . '%', 'LIKE');
$result = $query
->fields('url_alias')
->limit(variable_get('mpac_max_items', 20))
->execute();
foreach ($result as $alias) {
$matches[$alias->source] = check_plain($alias->alias) . t('*');
}
return $matches;
}