Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Save and save and publish


Reply

4 Posts   849 Views

Avatar
bebabeba

7 July 2010 at 7:15pm Community Member, 192 Posts

Hi!
I need to intersept the exact poin wich my page is save (for draft site) ans save and publish (for published site). Where are this function?
How my page.php call this?

Thanks!

Avatar
bebabeba

9 July 2010 at 3:37am Community Member, 192 Posts

help..
I need intercpt save draft site to add that in an other point of my page..

Avatar
Tonyair

9 July 2010 at 5:51am Community Member, 81 Posts

This is for StaffPage, for the Page is the same

$new = new StaffPage(); // Create new staff page      
$new->populateDefaults(); // if defaults are set
$new->setParent($_POST['ID']); // set parent page
$new -> update(
      array(
         'MenuTitle' => $title,
         'Title' => $title,
         'Locale' => $_POST['Locale'],
         'PhotoID' => $image->ID // adding image
      )
   );
$new->writeToStage('Stage'); // Save Page

Avatar
TotalNet

9 July 2010 at 10:10am Community Member, 181 Posts

Have you tried onBeforeWrite?
http://doc.silverstripe.org/datamodel#onbeforewrite