Hello...
I have tour and place page objects. I would like to have on a tour page places appear in order. By clicking on the place one should get to the place page, which shows all tours going through this place.
I was able to establish the many-many relationship between this two page objects by:
Tour.php
class Tour extends Page {
static $many_many = array(
'Places' => 'Place'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$placesTablefield = new ManyManyComplexTableField($this,'Places','Place',
array('Name' => 'Name'),'getCMSFields');
//$placesTablefield->setAddTitle('A Place');
$fields->addFieldToTab('Root.Content.Places', $placesTablefield);
return $fields;
}
}
Place.php
class Place extends Page {
static $db = array(
'Name' => 'Text'
);
static $belongs_many_many = array(
'Places' => 'Place'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('Name'), 'Name');
return $fields;
}
}
1) I am using an additional field to show up in the CMS Places tab 'name'. How can I reference the place page name itself?
2) How can I prevent the 'Add' link showing up within the CMS Places Tab?
3) I need to have an additional numeric field in the Tour_Places table which will allow an ORDER BY. Can this be accomplished?
If so, a push in the right direction would be REALLY helpful. Thanks a lot.