Skip to content

Instantly share code, notes, and snippets.

@muskie9
Created February 3, 2016 22:36
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 muskie9/b294a676a2d744287e20 to your computer and use it in GitHub Desktop.
Save muskie9/b294a676a2d744287e20 to your computer and use it in GitHub Desktop.
<?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