Commit 8e889dc65d7df36f3fca88cd7046604e9432323c
1 parent
8c953953
20.07.16
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
frontend/components/BgWidget.php
... | ... | @@ -22,9 +22,12 @@ class BgWidget extends Widget{ |
22 | 22 | $this->bg = Bg::find()->orderBy('random()')->one(); |
23 | 23 | } |
24 | 24 | |
25 | - public function run(){ | |
26 | - return '<a id="bg" style="width:100%;height:100%;position:absolute;z-index:-1;background: url(/storage/bg/'.$this->bg->image.') center top no-repeat;" href="'.$this->bg->url.'" title="'.$this->bg->title.'"></a> | |
25 | + public function run(){ | |
26 | + if(isset($this->bg) && !empty($this->bg)){ | |
27 | + return '<a id="bg" style="width:100%;height:100%;position:absolute;z-index:-1;background: url(/storage/bg/'.$this->bg->image.') center top no-repeat;" href="'.$this->bg->url.'" title="'.$this->bg->title.'"></a> | |
27 | 28 | '; |
29 | + } | |
30 | + | |
28 | 31 | } |
29 | 32 | } |
30 | 33 | ?> |
31 | 34 | \ No newline at end of file | ... | ... |