API Mark image tracking as owned

This commit is contained in:
Damian Mooyman 2016-02-22 11:44:24 +13:00
parent a737f9c901
commit de6db9f5c6
2 changed files with 33 additions and 13 deletions

View File

@ -19,6 +19,16 @@ class SiteTreeFileExtension extends DataExtension {
'BackLinkTracking' => 'SiteTree.ImageTracking' // {@see SiteTreeLinkTracking}
);
/**
* Images tracked by pages are owned by those pages
*
* @config
* @var array
*/
private static $owned_by = array(
'BackLinkTracking'
);
public function updateCMSFields(FieldList $fields) {
$fields->insertAfter(
ReadonlyField::create(

View File

@ -41,13 +41,23 @@ class SiteTreeLinkTracking extends DataExtension {
private static $many_many = array(
"LinkTracking" => "SiteTree",
"ImageTracking" => "File"
"ImageTracking" => "File" // {@see SiteTreeFileExtension}
);
private static $belongs_many_many = array(
"BackLinkTracking" => "SiteTree.LinkTracking"
);
/**
* Tracked images are considered owned by this page
*
* @config
* @var array
*/
private static $owns = array(
"ImageTracking"
);
private static $many_many_extraFields = array(
"LinkTracking" => array("FieldName" => "Varchar"),
"ImageTracking" => array("FieldName" => "Varchar")