You are here

public function LockFieldsManager::getLockedFieldValue in TMGMT Translator Smartling 8.4

File

src/Smartling/LockFields/LockFieldsManager.php, line 134

Class

LockFieldsManager
Class LockFieldsManager

Namespace

Drupal\tmgmt_smartling\Smartling\LockFields

Code

public function getLockedFieldValue($entity_type, $entity_id, $lang_code, $field_name, $field_index, $field_value_name) {
  $entity = $this->entityTypeManager
    ->getStorage($entity_type)
    ->load($entity_id);
  $translation = $this->entityRepository
    ->getTranslationFromContext($entity, $lang_code);
  $locked_value = $translation
    ->get($field_name)
    ->getValue();
  return $locked_value[$field_index][$field_value_name];
}