Example #1
0
 /**
  * Determine the value of a field if a data source
  * is set and add it to the field itself.
  *
  * @param $field
  */
 protected function setValue(AbstractType $field)
 {
     if (!$this->dataSource) {
         return;
     }
     $value = $this->getValue($field->getName());
     if ($field instanceof Image) {
         $src = $this->dataSource instanceof ImageFieldSource ? $this->dataSource->getImagePath($field->getName()) : '';
         $field->setSrc($src);
     }
     $field->setValue($value);
     $field->appendOption('value', $value);
 }