You are here

public function Xml::validateImport in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 src/Plugin/tmgmt_file/Format/Xml.php \Drupal\tmgmt_smartling\Plugin\tmgmt_file\Format\Xml::validateImport()
  2. 8 src/Plugin/tmgmt_file/Format/Xml.php \Drupal\tmgmt_smartling\Plugin\tmgmt_file\Format\Xml::validateImport()
  3. 8.2 src/Plugin/tmgmt_file/Format/Xml.php \Drupal\tmgmt_smartling\Plugin\tmgmt_file\Format\Xml::validateImport()

Validates that the given file is valid and can be imported.

Parameters

$imported_file: File path to the file to be imported.

bool $is_file: (optional) Whether $imported_file is the path to a file or not.

Return value

Job Returns the corresponding translation job entity if the import file is valid, FALSE otherwise.

Overrides Html::validateImport

File

src/Plugin/tmgmt_file/Format/Xml.php, line 60

Class

Xml
Export into XML.

Namespace

Drupal\tmgmt_smartling\Plugin\tmgmt_file\Format

Code

public function validateImport($imported_file, $job = TRUE) {
  $xml = simplexml_load_file($imported_file);
  if (!$xml) {
    return FALSE;
  }
  return TRUE;
}