function content_translation_field_info_alter
Same name in other branches
- 9 core/modules/content_translation/content_translation.module \content_translation_field_info_alter()
- 10 core/modules/content_translation/content_translation.module \content_translation_field_info_alter()
- 11.x core/modules/content_translation/content_translation.module \content_translation_field_info_alter()
Implements hook_field_info_alter().
Content translation extends the @FieldType annotation with following key:
- column_groups: contains information about the field type properties
which columns should be synchronized across different translations and
which are translatable. This is useful for instance to translate the
"alt" and "title" textual elements of an image field, while keeping the
same image on every translation. Each group has the following keys:
- title: Title of the column group.
- translatable: (optional) If the column group should be translatable by default, defaults to FALSE.
- columns: (optional) A list of columns of this group. Defaults to the name of the group as the single column.
- require_all_groups_for_translation: (optional) Set to TRUE to enforce that making this column group translatable requires all others to be translatable too.
See also
Drupal\image\Plugin\Field\FieldType\ImageItem
File
-
core/
modules/ content_translation/ content_translation.module, line 308
Code
function content_translation_field_info_alter(&$info) {
foreach ($info as $key => $settings) {
// Supply the column_groups key if it's not there.
if (empty($settings['column_groups'])) {
$info[$key]['column_groups'] = [];
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.