Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

add method to core class


Go to End


9 Posts   4389 Views

Avatar
chrisdarl

Community Member, 33 Posts

14 April 2009 at 9:59pm

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');

Go to Top