/**
  * @param mixed $class
  * @return FormField
  */
 public function castedCopy($class)
 {
     /** @var FormField $copy */
     $copy = Injector::inst()->create($class, $this->name);
     if ($copy->hasMethod('setConfig')) {
         /** @var DateField $copy */
         $config = $this->getConfig();
         foreach ($config as $k => $v) {
             $copy->setConfig($k, $v);
         }
     }
     return parent::castedCopy($copy);
 }
 public function castedCopy($class)
 {
     $copy = parent::castedCopy($class);
     if ($copy->hasMethod('setConfig')) {
         $config = $this->getConfig();
         foreach ($config as $k => $v) {
             /** @var TimeField $copy */
             $copy->setConfig($k, $v);
         }
     }
     return $copy;
 }