protected function createHtmlObject($filePath, $location, $publisher) { $file = MMSynchFileManager::fromFileName($this->article->getOrigin(), $publisher, MMSynchFileManager::HTML_FOLDER, $filePath); $fullPath = $file->getFullPath(); $html = self::getFileContent($fullPath); $filenamePos = strrpos($filePath, '/'); $fileName = substr($filePath, $filenamePos ? $filenamePos + 1 : 0); $remoteID = md5($this->article->remoteId().$fileName); $lang = $this->article->getLanguage(); $content = SQLIContent::fromRemoteID($remoteID); if ( $content instanceof SQLIContent ) { if ( !isset($content->fields[$lang]) ) { $content->addTranslation( $lang ); } $content->setActiveLanguage( $lang ); } else { $content = SQLIContent::create( new SQLIContentOptions( array( 'class_identifier' => 'html', 'remote_id' => md5($this->article->remoteId() . $fileName), 'language' => $lang ))); } $content->fields->title = $fileName; $content->fields->text = $html; $content->addLocation($location); MMSynchContentPublisher::getInstance()->publish($content); $file->setCanArchived(); return $content; }