Skip to content

Instantly share code, notes, and snippets.

@mmichelli
Created March 28, 2011 08:02
Show Gist options
  • Save mmichelli/890141 to your computer and use it in GitHub Desktop.
Save mmichelli/890141 to your computer and use it in GitHub Desktop.
AccessoriesWidget.php
<?php
class AccessoriesWidget extends Widget {
static $db = array(
"Title" => "Varchar",
);
static $many_many = array (
'Pages' => 'Page'
);
static $title = "Accessories";
static $cmsTitle = "Related pages";
static $description = "Add related pages";
function getCMSFields() {
return new FieldSet(
new CheckboxSetField("Pages", "Related", DataObject::get('Page'))
);
}
}
?>
<?PHP
//From the Page class
static $belongs_many_many = array (
'widgets' => 'AccessoriesWidget'
);
?>
@mmichelli
Copy link
Author

static $belongs_many_many = array (
    'widgets' => 'AccessoriesWidget'
); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment