I have an image I am using on my home page that is controlled form the Image tab on my CMS for that page. I added treedropdown field and then a checkbox to note if the user wants the selected page to be a link or not.
I cant get the checkbox to control the IF statement. Do i need to do something else in the IF statement, like note a value or something? right now the IF staement makes the DonatePhotoLink div appear all the time no matter the checkbox state. Thanks in advance!
page.ss
<div id="DonateImageHome">
<div id="DonatePhotoHome">$Photo</div>
<% if ActivateLink %><div id="DonatePhotoLink"> </div><% end_if %>
</div>
page.php
class Page extends SiteTree {
static $db = array(
);
static $has_one = array(
'Photo' => 'Image',
'MainImageLink' => 'SiteTree',
'ActivateLink' => 'Boolean'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField("Photo"));
$fields->addFieldToTab('Root.Content.Images', new TreeDropdownField('MainImageLinkID', 'Link image to', 'SiteTree'));
$fields->addFieldToTab('Root.Content.Images', new CheckboxField ('ActivateLink'));
return $fields;
}
}