You are here

public function LockFieldsManager::getLockedFieldsByContentEntityData in TMGMT Translator Smartling 8.4

Returns list of locked fields for an entity by its data.

Parameters

$entity_type:

$entity_id:

$lang_code:

array $default:

Return value

array

File

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

Class

LockFieldsManager
Class LockFieldsManager

Namespace

Drupal\tmgmt_smartling\Smartling\LockFields

Code

public function getLockedFieldsByContentEntityData($entity_type, $entity_id, $lang_code, array $default = []) {
  try {
    $entity = $this->entityTypeManager
      ->getStorage($entity_type)
      ->load($entity_id);
  } catch (\Exception $e) {
    return [];
  }
  if (empty($entity)) {
    return [];
  }
  $translation = $this->entityRepository
    ->getTranslationFromContext($entity, $lang_code);
  return $this
    ->getLockedFieldsByContentEntity($translation, $default);
}