Exemplo n.º 1
0
 /**
  * Add the field to the relation and set the sort order
  * @see UploadField::encodeFileAttributes()
  */
 protected function encodeFileAttributes(File $file)
 {
     $attributes = parent::encodeFileAttributes($file);
     $sortField = $this->getSortColumn();
     $record = $this->getRecord();
     $relationName = $this->getName();
     if ($record && $relationName && ($list = $record->{$relationName}())) {
         if ($record->many_many($relationName) !== null) {
             $list->add($file, array($sortField => $list->count() + 1));
         }
     }
     return $attributes;
 }