content_translation_field_info_alter(&$info)
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 he 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 214
- Allows entities to be translated into different languages.
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'] = array(); } } }
Please login to continue.