-
-
Save muskie9/b294a676a2d744287e20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param null $params | |
* @return FieldList | |
*/ | |
public function getFrontEndFields($params = null) | |
{ | |
$fields = parent::getFrontEndFields($params); | |
$fields->push(HeaderField::create('form-header', 'Recipe Form', 3)); | |
$fields->changeFieldOrder(array( | |
'form-header', | |
'Title', | |
'Summary', | |
'Image', | |
'Description' | |
)); | |
$imageField = FileField::create('Image') | |
->setTitle('Image') | |
->setFolderName('Uploads/RecipeImages') | |
->setRightTitle('Only JPG, PNG or GIF files allowed.'); | |
$imageField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png')); | |
$fields->replaceField('Image', $imageField); | |
$fields->replaceField('Description', SimpleHtmlEditorField::create('Description')->setTitle('Recipe Description')); | |
$fields->removeByName(array( | |
'URLSegment', | |
'Approved', | |
'ApprovedByID', | |
'ApprovedDate' | |
)); | |
$this->extend('updateFrontEndFields', $fields); | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment