Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Can I access data from getCMSFields?

$
0
0

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;
}
}


Posted to: Can I access data from getCMSFields? | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Latest Images

Trending Articles



Latest Images