/**
  * @return SS_List
  */
 public function getItems()
 {
     $name = $this->getName();
     if (!$this->items || !$this->items->exists()) {
         $record = $this->getRecord();
         $this->items = array();
         // Try to auto-detect relationship
         if ($record && $record->exists()) {
             if ($record->has_many($name) || $record->many_many($name)) {
                 // Ensure relationship is cast to an array, as we can't alter the items of a DataList/RelationList (see below)
                 $this->items = $record->{$name}()->toArray();
             } elseif ($record->has_one($name)) {
                 $item = $record->{$name}();
                 if ($item && $item->exists()) {
                     $this->items = array($record->{$name}());
                 }
             }
         }
         $this->items = new ArrayList($this->items);
         // hack to provide $UploadFieldThumbnailURL, $hasRelation and $UploadFieldEditLink in template for each file
         if ($this->items->exists()) {
             foreach ($this->items as $i => $file) {
                 $this->items[$i] = $this->customiseFile($file);
                 if (!$file->canView()) {
                     unset($this->items[$i]);
                 }
                 // Respect model permissions
             }
         }
     }
     return $this->items;
 }
 public function exists()
 {
     return $this->list->exists();
 }