You are here

public function FormatConverter::convert_to_standard in Lingotek Translation 8

This function determines which converter function is needed. If there is not a converter function for the selected document then it defaults to JSON (in the else statement) and attempts the conversion with the assumption of working with a JSON file.

@author Unkown

Return value

StandardImportObject $importObject An object that can be imported into WP

File

src/Form/FormatConverter.php, line 60

Class

FormatConverter

Namespace

Drupal\lingotek\Form

Code

public function convert_to_standard() {
  if (method_exists($this, $this->format . '_to_standard')) {
    $importObject = call_user_func(array(
      $this,
      $this->format . '_to_standard',
    ), $this->source_doc, $this->content);
    return $importObject;
  }
  else {
    $importObject = call_user_func(array(
      $this,
      'json_to_standard',
    ), $this->source_doc, $this->content);
    return $importObject;
  }
}