Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created July 10, 2015 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinglozzer/bf49a1f754ccc3ca9d6b to your computer and use it in GitHub Desktop.
Save kinglozzer/bf49a1f754ccc3ca9d6b to your computer and use it in GitHub Desktop.
<?php
class CMSMainExtension extends Extension {
/**
* @var array
*/
private static $allowed_actions = array(
'cloneAction'
);
public function cloneAction(array $data, Form $form) {
$record = DataObject::get_by_id("SiteTree", $data['ID']);
// Do clone stuff
return $this->owner->getResponseNegotiator()->respond($this->owner->request);
}
}
CMSMain:
extensions:
- CMSMainExtension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment