function _language_selection_page_validate_language in Language Selection Page 6
Validate a string against an existing and enabled language prefix.
Parameters
$string: The string to compare to each language prefix.
Return value
object|NULL Returns a valid language object if $string match an existing prefix. Returns NULL is the $string doesn't match an existing language prefix.
3 calls to _language_selection_page_validate_language()
- _language_selection_page_detect_lang_from_cookie in includes/
language_selection_page.helpers.inc - Custom function who detect the language from a cookie.
- _language_selection_page_detect_lang_from_url in includes/
language_selection_page.helpers.inc - Custom function who detect the language from URL.
- _language_selection_page_detect_lang_from_url_argument in includes/
language_selection_page.helpers.inc - Custom function who detect the language from a URL argument.
File
- includes/
language_selection_page.helpers.inc, line 78 - This file contains all the custom functions needed for the module.
Code
function _language_selection_page_validate_language($string) {
$lang_list = language_list('enabled');
$lang_list = $lang_list[1];
foreach ($lang_list as $lang) {
if (!empty($lang->prefix) && $lang->prefix == $string) {
return $lang;
}
}
return NULL;
}