Hi,
I'm having an issue with DataObjects attaching to wrong translation pages.
<?php
class FAQPage extends Page {
static $has_many = array (
'FAQs' => 'FAQ'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$dom = new DataObjectManager(
$this,
'FAQs',
'FAQ',
array('Question'=>'Question'),
'getCMSFields_forPopup',
"FAQPageID = $this->ID"
);
$fields->addFieldToTab("Root.Content.FAQ", $dom);
return $fields;
}
}
?>
<?php
class FAQ extends DataObject {
static $db = array (
'Question' => 'Text',
'Answer' => 'Text'
);
static $has_one = array (
'FAQPage' => 'FAQPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Question'),
new TextField('Answer')
);
}
}
?>
When I go to the English version of FAQPage I can add FAQs fine. Then I select translations and choose the translated page (Mandarin in this case) and the FAQ DOM shows empty, as you'd expect. I add a new FAQ but then when I close lightbox the page refreshes showing all FAQ - the one I added plus the English ones. If I refresh the FAQ including the one I added are gone. Then If I switch back to English through the translations tab all FAQ including the Chinese one added show there. Then all FAQs show in the English page since the FAQPageID is the same for all.
Am I doing something wrong?
Also,
If I am viewing the English sitetree, then use the language dropdown > switch to Mandarin > select FAQPage > select FAQ tab > select "add a new FAQ" I get the error "I can't handle sub-URLs of a CMSMain object." in the lightbox popup.
This is revision 216. Please note there is a change between r216 and r217 that renders lightbox fullscreen (full window) on my browser (Mac FireFox 3.5.4).