public static function LingotekContentMetadata::loadByTargetId in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 4.0.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.0.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.1.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.3.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.4.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.5.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.6.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.7.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
- 3.8.x src/Entity/LingotekContentMetadata.php \Drupal\lingotek\Entity\LingotekContentMetadata::loadByTargetId()
Loads a Lingotek content metadata entity based on the entity type and id.
Parameters
string $target_entity_type_id: Target entity type id.
int $target_id: Entity id.
Return value
$this The Lingotek content metadata if one exists. Otherwise, returns default values.
5 calls to LingotekContentMetadata::loadByTargetId()
- LingotekContentTranslationService::setDocumentId in src/
LingotekContentTranslationService.php - Sets the Lingotek document id for a given entity.
- LingotekContentTranslationService::setJobId in src/
LingotekContentTranslationService.php - Sets the job ID of a given entity.
- LingotekContentTranslationService::setTargetStatus in src/
LingotekContentTranslationService.php - Sets the translation status of a given entity translation for a locale.
- LingotekJobManagementTests::createContent in tests/
src/ Functional/ LingotekJobManagementTests.php - LingotekNodeBulkFormTest::testNeedsUploadSourceStatusFilter in tests/
src/ Functional/ Form/ LingotekNodeBulkFormTest.php - Tests if the "Needs Upload" source status filter works in combination with other filters.
File
- src/
Entity/ LingotekContentMetadata.php, line 94
Class
- LingotekContentMetadata
- Defines the Lingotek content metadata entity.
Namespace
Drupal\lingotek\EntityCode
public static function loadByTargetId($target_entity_type_id, $target_id) {
$metadata = NULL;
if ($target_entity_type_id == NULL || $target_id == NULL) {
return NULL;
}
$entity_query = \Drupal::entityQuery('lingotek_content_metadata');
$entity_query
->condition('content_entity_type_id', $target_entity_type_id)
->condition('content_entity_id', $target_id);
$result = $entity_query
->execute();
if (!empty($result)) {
$metadata = self::load(reset($result));
}
if ($metadata === NULL) {
$metadata = new static([
'content_entity_type_id' => $target_entity_type_id,
'content_entity_id' => $target_id,
], 'lingotek_content_metadata');
}
return $metadata;
}