Swaiba - Finally getting around to this again. I just wanted to wanted to share a bit a code with you before I test it. For just setting up the ability to associate testimonial categories with a page, does this seem right:
change this:
<?php
class Category extends DataObject {
static $db = array(
'Title' => 'Text'
);
static $belongs_many_many = array(
'Testimonials' => 'Testimonial',
);
}
?>
to
<?php
class Category extends DataObject {
static $db = array(
'Title' => 'Text'
);
static $belongs_many_many = array(
'Testimonials' => 'Testimonial',
'Pages' => 'Page'
);
}
?>
AND
add to Page.php this:
static $many_many = array(
'Categories' => 'Category'
);
and this:
function getCMSFields() {
$fields = parent::getCMSFields();
$dos = DataObject::get('Category');
$map = $dos ? $map = $dos->toDropdownMap() : array();
$msf = new MultiSelectField("Categories",'Testimonial Categories', $map);
$fields->addFieldToTab('Root.Content.TestimonialCategories', $msf);
return $fields;
}
Thanks for taking a look at this!