Hello
Here is my problem :
I have a DataObject (Product) that adds a new product Tab in the backend (that is workin fine) but I also need to add another tab ActifsProduct in the Backend to take advantage of tyne mce wysiwyg and style functions.
I tried to it following the tutorial and it created some table field.
What I can't do is adding the tab to the backend codes below (in bold the lines I added to create my new tyni MCE tab:
if someone could help me it would be great
Product.php (the DataObject)
<?
class Product extends DataObject
{
static $db = array (
'Productname' => 'Text',
'Imagename' => 'Text',
'Presentation' => 'Text',
'Contenance' => 'Text',
'Actifs' => 'Text',
'Price' => 'Text'
);
static $has_one = array (
'ProductPage' => 'ProductPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Productname'),
new TextField('Imagename'),
new TextField('Presentation'),
new TextField('Contenance'),
new TextField('Actifs'),
new TextField('Price')
//new TextareaField('Quote')
);
}
public function Link() {
return $this->ProductPage()->Link("show/$this->ID");
}
public function FlashVar() {
return "myFlashVar=$this->Imagename";
}
}
and ProductPage.php (this where I guess I create new cms tabs)
<?
class ProductPage extends SiteTree
{
static $has_many = array (
'Products' => 'Product'
);
static $db = array(
'ActifsProduct' => 'HTMLText'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.Products", new DataObjectManager(
$this,
'Products',
'Product',
array('Productname'=>'Productname','Imagename'=>'Imagename','Presentation' => 'Presentation','Contenance' => 'Contenance','Actifs' => 'Actifs','Price' => 'Price'),
'getCMSFields_forPopup'
));
return $f;
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('ActifsProduct'), 'Content');
return $fields;
}
}
class ProductPage_Controller extends Page_Controller
{
public function index() {
return Director::redirect($this->Products()->First()->Link());
}
static $allowed_actions = array (
'show'
);
public function show() {
return array (
'Product' => DataObject::get_by_id("Product",$this->urlParams['ID'])
);
}
}
Thank you