Jump to:

10379 Posts in 2194 Topics by 1710 members

All other Modules

SilverStripe Forums » All other Modules » Attach file (doc,jpg..), in newsletter module

Discuss all other Modules here.

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1230 Views
  • Anonymous user
    Avatar
    Community Member
    1 Post

    Attach file (doc,jpg..), in newsletter module Link to this post

    i try to find how to attach a file in a news letter but i cant. Now, who can help me do it ? pls.

  • aimcom
    Avatar
    Community Member
    8 Posts

    Re: Attach file (doc,jpg..), in newsletter module Link to this post

    I have found the following solution for your problem:

    In your _config.php file, add the following line:

    Object::add_extension('Newsletter', 'MyNewsletter');

    Create a file called MyNewsletter.php:

    <?php

    class MyNewsletter extends DataObjectDecorator {
       public function extraStatics() {
          return array(
             'has_one' => array(
                'File' => 'File'
             )
          );
       }
       
       public function updateCMSFields(FieldSet $fields) {
          $fields->addFieldsToTab(
             'Root.Newsletter',
             array(
                new FileField('File', 'File') // doesn't work
             )
          );
       }
    }

    ?>

    Furthermore, you have to edit newsletter/code/Newsletter.php and modify the function getCMSFields():

    function getCMSFields($controller = null) {
       // ...
       
       $this->extend('updateCMSFields', $ret);
       return $ret;
    }

    By now, I haven't found a way to make the FileField / FileIFrameField work. Perhaps somebody else has an idea how to solve this issue?

    1230 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.