/**
  * Sets the value of the form field based on data from the request. Gets the list
  * of file IDs by running the $name() against the object. File relation can be
  * has_many or many_many.
  *
  * @param string The value to set
  * @param array The array of form data
  */
 public function setValue($value = null, $data = null)
 {
     if (!is_array($value)) {
         if (!$value && $data && $data instanceof DataObject && $data->hasMethod($this->name)) {
             $funcName = $this->name;
             if ($obj = $data->{$funcName}()) {
                 if ($obj instanceof DataObjectSet) {
                     $value = $obj->column('ID');
                 }
             }
         }
     }
     parent::setValue($value, $data);
 }
 /**
  * Sets the value of the form field based on data from the request. Automatically
  * adds the "ID" to the field name. Assumes a $has_one relation to the file.
  *
  * @param string The value to set
  * @param array The array of form data
  */
 public function setValue($value = null, $data = null)
 {
     if (!is_numeric($value)) {
         if ($id = Controller::curr()->getRequest()->requestVar($this->Name() . "ID")) {
             $value = $id;
         } elseif (!$value && $data && $data instanceof DataObject && $data->hasMethod($this->name)) {
             $funcName = $this->name;
             if ($obj = $data->{$funcName}()) {
                 if ($obj instanceof File) {
                     $value = $obj->ID;
                 }
             }
         }
     }
     parent::setValue($value, $data);
 }