Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class RelatedProductExtension extends DataExtension {
- private static $many_many = array(
- 'RelatedProducts' => 'Product'
- );
- public function updateProductCMSFields(&$fields) {
- $gridField = GridField::create(
- 'RelatedProducts',
- 'Related Products',
- $this->owner->getManyManyComponents('RelatedProducts'),
- GridFieldConfig::create()
- ->addComponent(new GridFieldButtonRow('before'))
- ->addComponent(new GridFieldAddExistingAutocompleter('buttons-before-left'))
- ->addComponent(new GridFieldDataColumns())
- ->addComponent(new GridFieldSortableHeader())
- ->addComponent(new GridFieldDeleteAction(true))
- );
- $fields->addFieldToTab('Root.RelatedProducts', $gridField);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement