Skip to content

Commit

Permalink
NewsArticle: Added Restrictions to Main Image Field
Browse files Browse the repository at this point in the history
  • Loading branch information
purplespider committed Jul 19, 2013
1 parent 4f3fa19 commit 2253e9d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions code/NewsArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ function getCMSFields() {

$fields->addFieldToTab('Root.Main', $datefield, 'Content');

$fields->addFieldToTab('Root.Main', $image = new UploadField('AttachedImage','Main Image'),"Content");
$image = new UploadField('AttachedImage', 'Main Image');
$image->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$image->setConfig('allowedMaxFileNumber', 1);
$image->setFolderName('Managed/NewsImages');
$image->setRightTitle("Displayed to the right of the content in the main article, where it can be clicked to enlarge. <br />A thumbnail also appears next to the article summary on the main News page.");

$image->setFolderName("Managed/NewsImages");

$fields->addFieldToTab('Root.Main', $image,"Content");

return $fields;
}

Expand Down

0 comments on commit 2253e9d

Please sign in to comment.