function module_globallink_is_field_translatable in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink.api.php \module_globallink_is_field_translatable()
- 7.6 globallink.api.php \module_globallink_is_field_translatable()
By implementing this hook, you can programmatically filter out if a particular field is translatable or not. If the field is not translatable, this method should not return anything (not even false). This hook overrides the field configuration settings on the Field Configuration tab.
Parameters
object $node: The node object on which this check is being performed.
string $field: The field name on which this check is being performed.
array $target_arr: The target language array as selected while creating the submission. Defaults to NULL.
Return value
bool TRUE if the field is translatable.
File
- ./
globallink.api.php, line 49 - This file provides an example for the implementation of hooks that other modules can implement. Please read documentation for more details.
Code
function module_globallink_is_field_translatable($node, $field, $target_arr = NULL) {
if ($node->type == 'article') {
if ($field == 'title' || $field == 'body') {
return TRUE;
}
}
else {
if ($target_arr != NULL) {
foreach ($target_arr as $language) {
if ($language == 'fr') {
if ($field == 'title') {
return TRUE;
}
}
}
}
}
}