I am trying to create a button that will fire off a function in the CMS admin panel, but I can't seem to get it to work.
here is what I tried first inside the getCMSFields function:
$fields->addFieldToTab('Root.Content.Seasons', new FormAction("EndSeason", "Finish Season"));
but that throws an error saying it cant find the function EndSeason in class form. I'm assuming the Form action needs to be in a proper form object, so then I tried:
function EndSeasonForm(){
$fields = new FieldSet(new NumericField ("Position"));
$actions = new FieldSet(new FormAction("EndSeason", "Finish Season"));
return new Form($this, 'EndSeasonForm', $fields, $actions);
}
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Seasons', $this->EndSeasonForm);
return $fields;
}
but that just breaks the whole CMS giving a "Call to a member function XML_val() on a non-object" error
Does anyone know how to do this type of thing?
cheer and Happy new year!