3070 Posts in 869 Topics by 651 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 230 Views |
-
Setting a Default ParentID

25 November 2012 at 1:25pm
I was wondering if its possible to set the ParentID of a pagetype to specific page. The pagetype is being controlled by a ModelAdmin instead of the pages interface. I've tryed setting the $defaults array in the __construct() but I get a class does not exist error
static $defaults;
/**
* Static methods
* ----------------------------------*/
public function __construct() {
$mainListingPage = SiteTree::get_by_link("listings");
$this->defaults = array(
"ParentID" => $mainListingPage->ID,
);
parent::__construct();
}Should I just handle it in the onBeforeWrite ?
-
Re: Setting a Default ParentID

11 December 2012 at 3:52am
Calling it in onBefore write was failing I ended up adding a hidden ParentID field to the form and setting the value with the function. When I have a chance I'll try onBeforeWrite again so I can trackdown the actual issue.
| 230 Views | ||
|
Page:
1
|
Go to Top |


