function globallink_get_translatable_node_types_and_names in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink.inc \globallink_get_translatable_node_types_and_names()
- 7.6 globallink.inc \globallink_get_translatable_node_types_and_names()
Gets translatable node types and names based on a content or entity translation.
Parameters
string $content_translation: The content translation type.
Return value
array Array of translatable node types and names.
3 calls to globallink_get_translatable_node_types_and_names()
- globallink_build_filters in ./
globallink.inc - Builds filters.
- globallink_create_submission in ./
globallink_background_jobs.inc - globallink_field in ./
globallink_field_configuration.inc - Renders form for globallink_field.
File
- ./
globallink.inc, line 223 - Miscellaneous GlobalLink functions for node translations (non-entity).
Code
function globallink_get_translatable_node_types_and_names($content_translation = '') {
$arr = array();
$node_types = node_type_get_types();
foreach ($node_types as $node_type) {
if ($content_translation) {
// Show only Node Translation (i18n) enabled content types.
if (translation_supported_type($node_type->type)) {
$arr[$node_type->type] = $node_type->name;
}
}
elseif ($content_translation === FALSE) {
// Show only Entity Translation enabled content types.
if (module_exists('entity_translation') && entity_translation_node_supported_type($node_type->type)) {
$arr[$node_type->type] = $node_type->name;
}
}
else {
// Show all translation enabled content types.
if (module_exists('entity_translation') && entity_translation_node_supported_type($node_type->type) || translation_supported_type($node_type->type)) {
$arr[$node_type->type] = $node_type->name;
}
}
}
asort($arr);
return $arr;
}