_content_translation_is_field_translatability_configurable

_content_translation_is_field_translatability_configurable(EntityTypeInterface $entity_type, FieldStorageDefinitionInterface $definition)

Checks whether translatability should be configurable for a field.

@internal

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.

File

core/modules/content_translation/content_translation.admin.inc, line 157
The content translation administration forms.

Code

function _content_translation_is_field_translatability_configurable(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']);
}
doc_Drupal
2016-10-29 09:57:08
Comments
Leave a Comment

Please login to continue.