You are here

public function LingotekConfigChunk::updateLocalContent in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.3 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::updateLocalContent()
  2. 7.5 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::updateLocalContent()

Updates the local content with data from a Lingotek Document.

Return value

bool TRUE if the content updates succeeded, FALSE otherwise.

Overrides LingotekTranslatableEntity::updateLocalContent

1 call to LingotekConfigChunk::updateLocalContent()
LingotekConfigChunk::contentUpdated in lib/Drupal/lingotek/LingotekConfigChunk.php
Event handler for updates to the config chunk's data.

File

lib/Drupal/lingotek/LingotekConfigChunk.php, line 654
Defines LingotekConfigChunk.

Class

LingotekConfigChunk
A class wrapper for Lingotek-specific behavior on ConfigChunks.

Code

public function updateLocalContent() {
  $metadata = $this
    ->metadata();
  $document_id = $metadata['document_id'];
  if (empty($document_id)) {
    LingotekLog::error('Unable to refresh local contents for config chunk @cid. Could not find Lingotek Document ID.', array(
      '@cid' => $this->cid,
    ));
    return FALSE;
  }
  $api = LingotekApi::instance();
  $document = $api
    ->getDocument($document_id);
  foreach ($document->translationTargets as $target) {
    $this
      ->updateLocalContentByTarget($target->lingotek_locale);
  }
}