Jump to:

5452 Posts in 1673 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » add method to core class

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2048 Views
  • chrisdarl
    Avatar
    Community Member
    33 Posts

    Re: add method to core class Link to this post

    That worked perfectly. Thank you!

    Here's the code I used if it helps anyone else..

    ====================

    Page.php
    --------------------
    public static $has_one = array(
       "TopImage" => "Image"
    );

    MyImage.php
    ---------------------
    class MyImage extends DataObjectDecorator {
       public function GenerateTitle() {
          return "abc";
       }
    }

    _config.php
    ----------------------
    DataObject::add_extension('Image', 'MyImage');

    2048 Views
Page: 1 2
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.