Advertisement
Guest User

Untitled

a guest
Apr 8th, 2014
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. class RelatedProductExtension extends DataExtension {
  3. private static $many_many = array(
  4. 'RelatedProducts' => 'Product'
  5. );
  6.  
  7. public function updateProductCMSFields(&$fields) {
  8. $gridField = GridField::create(
  9. 'RelatedProducts',
  10. 'Related Products',
  11. $this->owner->getManyManyComponents('RelatedProducts'),
  12. GridFieldConfig::create()
  13. ->addComponent(new GridFieldButtonRow('before'))
  14. ->addComponent(new GridFieldAddExistingAutocompleter('buttons-before-left'))
  15. ->addComponent(new GridFieldDataColumns())
  16. ->addComponent(new GridFieldSortableHeader())
  17. ->addComponent(new GridFieldDeleteAction(true))
  18. );
  19. $fields->addFieldToTab('Root.RelatedProducts', $gridField);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement