Source of file Page.php
Size: 1,221 Bytes - Last Modified: 2021-12-23T10:42:17+00:00
/var/www/docs.ssmods.com/process/src/src/Page.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?php namespace { use SilverStripe\Assets\Image; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\SiteConfig\SiteConfig; class Page extends SiteTree { private static $has_one = array( "BackgroundImage" => Image::class ); public function getCMSFields() { $fields = parent::getCMSFields(); return $fields; } public function MyBackgroundImage() { if ($this->BackgroundImageID) { if ($image = $this->BackgroundImage()) { return $image; } } if ($this->ParentID) { if ($parent = SiteTree::get()->byID($this->ParentID)) { return $parent->MyBackgroundImage(); } } if ($this->URLSegment != 'home') { if ($homePage = SiteTree::get()->filter(array('URLSegment' => 'home'))->first()) { return $homePage->MyBackgroundImage(); } } if ($siteConfig = SiteConfig::current_site_config()) { return $siteConfig->BackgroundImage(); } } } } |