function farm_api_farm_info in farmOS 7
Implements hook_farm_api_farm_info().
File
- modules/
farm/ farm_api/ farm_api.module, line 165 - Farm API module.
Code
function farm_api_farm_info() {
global $base_url, $conf, $user, $language;
// Include info that requires the farm_info scope.
$info = array(
'name' => array(
'info' => $conf['site_name'],
'scope' => 'farm_info',
),
'url' => array(
'info' => $base_url,
'scope' => 'farm_info',
),
'api_version' => array(
'info' => FARM_API_VERSION,
'scope' => 'farm_info',
),
);
// Include user info if logged in.
if (!empty($user->uid)) {
$info['user'] = array(
'uid' => $user->uid,
'name' => $user->name,
'mail' => $user->mail,
'language' => $language->language,
);
}
// Include list of installed languages.
$languages = language_list();
foreach ($languages as $langcode => $language) {
if (!empty($language->enabled)) {
$info['languages'][$langcode] = array(
'language' => $language->language,
'name' => $language->name,
'native' => $language->native,
'direction' => $language->direction,
);
}
}
return $info;
}