You are here

public function LingotekImportForm::import_standard_object in Lingotek Translation 8

1 call to LingotekImportForm::import_standard_object()
LingotekImportForm::import in src/Form/LingotekImportForm.php
This function is to import a document from the TMS.

File

src/Form/LingotekImportForm.php, line 231
Contains \Drupal\Lingotek\Form\LingotekManagementForm.

Class

LingotekImportForm
@file Contains \Drupal\Lingotek\Form\LingotekManagementForm.

Namespace

Drupal\lingotek\Form

Code

public function import_standard_object(StandardImportObject $object) {
  $content_cloud_import_format = $this->lingotek
    ->get('preference.content_cloud_import_format');
  $content_cloud_import_status = $this->lingotek
    ->get('preference.content_cloud_import_status');
  $node = Node::create(array(
    'nid' => NULL,
    'type' => $content_cloud_import_format,
    'title' => $object
      ->getTitle(),
    'langcode' => 'en',
    'uid' => 1,
    'status' => $content_cloud_import_status,
    'body' => array(
      'value' => $object
        ->getContent(),
      'format' => 'full_html',
    ),
    'field_fields' => array(),
  ));
  $node
    ->save();
  if ($node->node_id) {
    $success = 0;
  }
  else {
    $success = 1;
  }
  return $success;
}