Hello,
I want to add a form where the user in the backend can link a page with multiple other pages. Something like "You might also be interested in..." but NOT dynamically generated.
I found this tutorial:
http://blog.fraser-hart.co.uk/silverstripe-3-gridfield-with-many_many-relationship/
but the problem is, that when I set a relation the site tree is modified.
What I want is something like:
Frontpage is linked with About page
Contact page is linked with About Page and Imprint
etc.
How do I have to modify this code to achieve this?
public static $has_many = array(
'Boxes' => 'Page'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$gridFieldConfig = GridFieldConfig_RelationEditor::create()->addComponents(
new GridFieldDeleteAction('unlinkrelation')
);
$gridField = new GridField("Boxes", "Boxes", $this->Boxes(), $gridFieldConfig);
$fields->addFieldToTab("Root.Boxes", $gridField);
return $fields;
}