Skip to content

Instantly share code, notes, and snippets.

@wilr
Created August 6, 2014 10:10
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 wilr/f478f6a7873492433e71 to your computer and use it in GitHub Desktop.
Save wilr/f478f6a7873492433e71 to your computer and use it in GitHub Desktop.
<?php
class TestAdmin extends LeftAndMain {
private static $url_segment = 'test';
function getEditForm($id = NULL, $fields = NULL) {
return Form::create(
$this,
'EditForm',
new FieldList(
new TextField('Name')
),
new FieldList(
FormAction::create('doSubmit')
)
)
// JS and CSS use this identifier
->setHTMLID('Form_EditForm')
// Required for correct CMS layout
->addExtraClass('cms-edit-form')
->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
}
public function doSubmit($data, $form) {
return "<h1>Hi</h1>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment