PHP code example of zanderwar / silverstripe-thankfully
1. Go to this page and download the library: Download zanderwar/silverstripe-thankfully library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zanderwar / silverstripe-thankfully example snippets
ContactPage::add_extension('ThankfullyExtension');
ContactPage::add_extension('ThankfullyControllerExtension');
class ExamplePage_Controller extends Page_Controller {
private static $allowed_actions = array(
'index'
);
public function index()
{
/** @var ThankfullyPage $thankYou */
$thankYou = $this->getThankYouPage();
$thankYou->setAllowed(true); // Required if "Always Allowed" is disabled in the CMS
$thankYou->setReturnTo('/home/'); // Optional, if not provided the link to the parent page will be used
return $this->redirect($thankYou->Link());
}
}