static array $db
create your datamodel in this array (dont forget to run /dev/build/ after making changes!)
static $db = array(
"Content" = "Text"
);
function getCMSFields()
lets you overload / overwrite the fields in the cms view
function getCMSFields() {
return new FieldSet(
new TextareaField("Content")
);
}
function forTemplate()
is the function that gets called to render the element. Default behavior is to render the element in the classname template, eg MyTestElement will render in MyTestElement.ss
This behavior can be overwritten by returning whatever you like:
function forTemplate() {
return $this->Content;
}
function forCMSTemplate()
some elements require to be rendered different in the CMS view than on the front end. This could be to avoid javascript conflicts or simply to speed up loading.
Unless overwritten, this function returns the value of Element::forTemplate()
function forCMSTemplate() {
return $this->obj("Content")->escapeXML();
}
function getExtraCMSFields()