function ContentTranslationFormLanguageHooks::isFieldTranslatabilityConfigurable

Checks whether translatability should be configurable for a field.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.

\Drupal\Core\Field\FieldStorageDefinitionInterface $definition: The field storage definition.

Return value

bool TRUE if field translatability can be configured, FALSE otherwise.

1 call to ContentTranslationFormLanguageHooks::isFieldTranslatabilityConfigurable()
ContentTranslationFormLanguageHooks::formLanguageContentSettingsFormAlter in core/modules/content_translation/src/Hook/ContentTranslationFormLanguageHooks.php
Implements hook_form_FORM_ID_alter() for language_content_settings_form().

File

core/modules/content_translation/src/Hook/ContentTranslationFormLanguageHooks.php, line 240

Class

ContentTranslationFormLanguageHooks
Form hook implementations for content_translation.

Namespace

Drupal\content_translation\Hook

Code

protected function isFieldTranslatabilityConfigurable(EntityTypeInterface $entity_type, FieldStorageDefinitionInterface $definition) {
  // Allow to configure only fields supporting multilingual storage. We skip
  // our own fields as they are always translatable. Additionally we skip a
  // set of well-known fields implementing entity system business logic.
  return $definition->isTranslatable() && $definition->getProvider() != 'content_translation' && !in_array($definition->getName(), [
    $entity_type->getKey('langcode'),
    $entity_type->getKey('default_langcode'),
    'revision_translation_affected',
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.