Okay I have spent sometime trying to fine an answer to my problem but cannot seem to find one. I need to upload an image to a newsletter draft in the cms, I don't want to use tinymce as I want to position them using the template. Any help greatly appreciated.
This the code I have tried to add to the newsletter.php but get a error saying:
[User Error] Unknown Email ID: 0
GET /admin/newsletter/NewsletterEditForm/field/MainImage/iframe
Line 548 in /var/www/web56/web/newsletter/code/NewsletterAdmin.php
newsletter.php
===============
/**
* Single newsletter instance. Each Newsletter belongs to a NewsletterType.
*
* @package newsletter
*/
class Newsletter extends DataObject {
static $db = array(
"Status" => "Enum('Draft, Send', 'Draft')",
"Content" => "HTMLText",
"Subject" => "Varchar(255)",
"SentDate" => "Datetime",
);
static $has_one = array(
"MainImage" => "Image",
"Parent" => "NewsletterType",
);
static $has_many = array(
"Recipients" => "Newsletter_Recipient",
"SentRecipients" => "Newsletter_SentRecipient",
);
/**
* Returns a FieldSet with which to create the CMS editing form.
* You can use the extend() method of FieldSet to create customised forms for your other
* data objects.
*
* @param Controller
* @return FieldSet
*/
function getCMSFields($controller = null) {
$group = DataObject::get_by_id("Group", $this->Parent()->GroupID);
$sent_status_report = $this->renderWith("Newsletter_SentStatusReport");
$previewLink = Director::absoluteBaseURL() . 'admin/newsletter/preview/' . $this->ID;
$ret = new FieldSet(
new TabSet("Root",
$mailTab = new Tab(_t('Newsletter.NEWSLETTER', 'Newsletter'),
new TextField("Subject", _t('Newsletter.SUBJECT', 'Subject'), $this->Subject),
new HtmlEditorField("Content", _t('Newsletter.CONTENT', 'Content')),
new ImageField("MainImage", _t('Newsletter.IMAGE', 'Photo')),
new LiteralField('PreviewNewsletter', "<a href=\"$previewLink\" target=\"_blank\">" . _t('PREVIEWNEWSLETTER', 'Preview this newsletter') . "</a>")
),
$sentToTab = new Tab(_t('Newsletter.SENTREPORT', 'Sent Status Report'),
new LiteralField("Sent Status Report", $sent_status_report)
)
)
);
===============