Jump to content

Saving via API multilingual field


Recommended Posts

I have create a module base on Cramer's Import Pages From CSV in order to be able to import bilingual data. I based my code with the help of this page

While the title, the body (page_content) field are saved, I cannot save the french path (this is an import of previous blog entries from another CMS. I must keep the URL. The english URL is saved).

		$p->of(false);
		if($columns['Titre'] != "") {
			$french = $this->languages->get("francais");
			$p->of(false); //
			$p->title->setLanguageValue($french, $columns['Titre']);
			$p->page_content->setLanguageValue($french, $columns['Corps']);
			$p->name->setLanguageValue($french, $columns['Chemin']);
			$p->status->setLanguageValue($french, 1);
		}

I get this error

french.thumb.png.374dcb670e86435fee099ec340a3ad44.png

Link to comment
Share on other sites

Ok, got it.

$french = $this->languages->get("francais");
$page->of(false); //
page->setLanguageValue($french, 'title', $columns['Titre']);
$page->setName($columns['Chemin'], $french);
$page->set("status$french", 1);

 

Edited by Guy Verville
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...