Guest User

Untitled

a guest
Sep 13th, 2018
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1. <?PHP
  2. namespace {
  3.  
  4.     use SilverStripe\CMS\Controllers\ContentController;
  5.     use SilverStripe\UserForms\Control\UserDefinedFormController;
  6.     use SilverStripe\UserForms\Model\UserDefinedForm;
  7.  
  8.     class PageController extends ContentController
  9.     {
  10.         /**
  11.          * An array of actions that can be accessed via a request. Each array element should be an action name, and the
  12.          * permissions or conditions required to allow the user to access it.
  13.          *
  14.          * <code>
  15.          * [
  16.          *     'action', // anyone can access this action
  17.          *     'action' => true, // same as above
  18.          *     'action' => 'ADMIN', // you must have ADMIN permissions to access this action
  19.          *     'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
  20.          * ];
  21.          * </code>
  22.          *
  23.          * @var array
  24.          */
  25.         private static $allowed_actions = [];
  26.  
  27.         protected function init()
  28.         {
  29.             parent::init();
  30.             // You can include any CSS or JS required by your project here.
  31.             // See: https://docs.silverstripe.org/en/developer_guides/templates/requirements/
  32.         }
  33.  
  34.        
  35.         public function Form(){
  36.             $page = UserDefinedForm::get()->filter(['URLSegment' => 'userform'])->First();
  37.             $form = (new UserDefinedFormController($page))->Form();            
  38.             return $form;
  39.         }
  40.        
  41.     }
  42. }
Add Comment
Please, Sign In to add comment