Implements TMGMTFileExportInterface::import().
Overrides FormatInterface::import
public function import($imported_file, $is_file = TRUE) {
$dom = new \DOMDocument();
$is_file ? $dom
->loadHTMLFile($imported_file) : $dom
->loadHTML($imported_file);
$xml = simplexml_import_dom($dom);
$data = array();
foreach ($xml
->xpath("//div[@class='atom']") as $atom) {
// Assets are our strings (eq fields in nodes).
$key = $this
->decodeIdSafeBase64((string) $atom['id']);
$data[$key]['#text'] = (string) $atom;
}
return \Drupal::service('tmgmt.data')
->unflatten($data);
}