Splits the given path into prefix and actual path.
Parse the given path and return the language object identified by the prefix and the actual path.
$path: The path to split.
$languages: An array of valid languages.
An array composed of:
function language_url_split_prefix($path, $languages) {
$args = empty($path) ? array() : explode('/', $path);
$prefix = array_shift($args);
// Search prefix within enabled languages.
$prefixes = language_negotiation_url_prefixes();
foreach ($languages as $language) {
if (isset($prefixes[$language->langcode]) && $prefixes[$language->langcode] == $prefix) {
// Rebuild $path with the language removed.
return array(
$language,
implode('/', $args),
);
}
}
return array(
FALSE,
$path,
);
}