*** newbie/noob question (sorry) ***
I have extended SiteTree in my Page.php to provide support for banner images on pages within my site - and this works as intended, for example:
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
'BannerImage' => 'Page_BannerImage',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields ->addFieldsToTab(
'Root.Content.Banner',
new ImageField('BannerImage', 'Banner')
);
return $fields;
}
function getBannerImageRecursive() {
$page = $this;
$banner = $this->BannerImage();
while(!$banner->ID && $page->ParentID !=0) {
$page = $page->Parent();
$banner = $page->BannerImage();
}
return $banner;
}
The obstacle I have encountered is that once an image is selected from the File Store and attached to a page, that image is no longer referenced in the File Store list and cannot (apparently) be used as an attachment for another page. Yes, I know that I can attach an image from my file system (workaround?) yet, I am looking for a method that continues to enumerate the files/images on the File Store list.
Any ideas???