Hi guys,
I'm new in SilverStripe and i'm not quite sure i can do this.
Can i access the data from getCMSField?
class ImageDemo extends Page
{
static $db = array(
'Title' => 'Varchar'
);
static $has_one = array(
'Graphic' => 'Image'
);
public function getCMSFields($params = null){
$fields = parent::getCMSFields($params);
if ($this->Graphic.exists()) { <--------------- I wanna check if the data exist in Graphic
$fields->addFieldToTab("Root.Content.Main", new UploadField('Graphic', "A Feature Image"), "Content");
}
else
{
$fields->addFieldToTab("Root.Content.Main", new TextField('Graphic', "A Feature Image"), "Content");
}
return $fields;
}
}