function _hosting_package_instances_load_languages in Hostmaster (Aegir) 6
Get the languages associated with an instance of a package.
2 calls to _hosting_package_instances_load_languages()
- _hosting_package_instances_load in modules/
hosting/ package/ hosting_package.instance.inc - _hosting_package_instance_languages in modules/
hosting/ package/ hosting_package.instance.inc
File
- modules/
hosting/ package/ hosting_package.instance.inc, line 144 - API for mapping packages to various Hosting node types
Code
function _hosting_package_instances_load_languages($instance_id = NULL, $reset = FALSE) {
static $instances = array();
if (!empty($reset)) {
$instances = array();
}
// Build the array of languages if requested and we need to.
if (!is_null($instance_id) && !isset($instances[$instance_id])) {
$languages = array(
'en' => 'en',
);
// load language options: if argument is null, load all language options
$lang_result = db_query("SELECT DISTINCT(language) FROM {hosting_package_languages} WHERE iid = %d", $instance_id);
while ($language = db_fetch_object($lang_result)) {
$languages[$language->language] = _hosting_language_name($language->language);
}
$instances[$instance_id] = $languages;
}
// Return the array of languages if requested.
return !is_null($instance_id) ? $instances[$instance_id] : NULL;
}