Skip to content

Commit

Permalink
Merge pull request #228 from assertchris/reorder-fields
Browse files Browse the repository at this point in the history
Reordered fields
  • Loading branch information
Damian Mooyman committed May 14, 2015
2 parents a7bf039 + b62370c commit 17832fd
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions code/model/BlogPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ public function getCMSFields() {
$self =& $this;

$this->beforeUpdateCMSFields(function ($fields) use ($self) {
$uploadField = UploadField::create('FeaturedImage', _t('BlogPost.FeaturedImage', 'Featured Image'));
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));

/**
* @var FieldList $fields
*/
$fields->insertAfter($uploadField,'Content');

$summary = HtmlEditorField::create('Summary', false);
$summary->setRows(5);
$summary->setDescription(_t(
Expand All @@ -182,18 +190,7 @@ public function getCMSFields() {
$summaryHolder->setHeadingLevel(4);
$summaryHolder->addExtraClass('custom-summary');

/**
* @var FieldList $fields
*/
$fields->insertBefore($summaryHolder, 'Content');

$uploadField = UploadField::create('FeaturedImage', _t('BlogPost.FeaturedImage', 'Featured Image'));
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));

$fields->insertAfter(
$uploadField,
'Content'
);
$fields->insertAfter($summaryHolder, 'FeaturedImage');

$fields->push(HiddenField::create('MenuTitle'));

Expand Down

0 comments on commit 17832fd

Please sign in to comment.